lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 16 Jul 2020 11:36:10 +0100
From:   John Garry <john.garry@...wei.com>
To:     Will Deacon <will@...nel.org>, Robin Murphy <robin.murphy@....com>
CC:     Qi Liu <liuqi115@...wei.com>, <mark.rutland@....com>,
        <linux-kernel@...r.kernel.org>, <linuxarm@...wei.com>,
        <zhangshaokun@...ilicon.com>, <wang.wanghaifeng@...wei.com>,
        <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH] drivers/perf: Fix kernel panic when rmmod PMU modules
 during perf sampling

On 16/07/2020 11:30, Will Deacon wrote:
> On Thu, Jul 16, 2020 at 11:26:25AM +0100, Robin Murphy wrote:
>> On 2020-07-16 10:41, Will Deacon wrote:
>>> On Thu, Jul 16, 2020 at 05:19:25PM +0800, Qi Liu wrote:
>>>> Kernel panic will also happen when users try to unbind PMU drivers with
>>>> device. This unbind issue could be solved by another patch latter.
>>>>
>>>>    drivers/perf/arm_smmuv3_pmu.c                 | 1 +
>>>>    drivers/perf/fsl_imx8_ddr_perf.c              | 1 +
>>>>    drivers/perf/hisilicon/hisi_uncore_ddrc_pmu.c | 1 +
>>>>    drivers/perf/hisilicon/hisi_uncore_hha_pmu.c  | 1 +
>>>>    drivers/perf/hisilicon/hisi_uncore_l3c_pmu.c  | 1 +
>>>>    5 files changed, 5 insertions(+)
>>>>
>>>> diff --git a/drivers/perf/arm_smmuv3_pmu.c b/drivers/perf/arm_smmuv3_pmu.c
>>>> index 48e28ef..90caba56 100644
>>>> --- a/drivers/perf/arm_smmuv3_pmu.c
>>>> +++ b/drivers/perf/arm_smmuv3_pmu.c
>>>> @@ -742,6 +742,7 @@ static int smmu_pmu_probe(struct platform_device *pdev)
>>>>    	platform_set_drvdata(pdev, smmu_pmu);
>>>>
>>>>    	smmu_pmu->pmu = (struct pmu) {
>>>> +		.module		= THIS_MODULE,
>>> I thought platform_driver_register() did this automatically?
>> For the platform device itself, yes, but this is for the PMU device - perf
>> needs to take a reference to the module, otherwise the platform device can
>> still be pulled out from under its feet.
> Urgh, gross.
> 
>> I can't remember if we ever discussed making perf_pmu_register() do the same
>> trick as platform_device_register() and friends, but obviously it's a
>> possibility.
> Yeah, but I suppose this patch is the right thing to do for now. I'll queue
> it as a fix.
> 

Please also note what Qi Liu wrote about being able to unbind the driver 
and cause the same issue. I don't know if you can about that issue also.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ