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]
Message-ID: <ec16c0b5-b8c7-3bd1-e733-f054ec3c2cd1@quicinc.com>
Date:   Fri, 20 May 2022 09:08:52 -0700
From:   Jeff Johnson <quic_jjohnson@...cinc.com>
To:     <duoming@....edu.cn>
CC:     Kalle Valo <kvalo@...nel.org>, <linux-kernel@...r.kernel.org>,
        <amitkarwar@...il.com>, <ganapathi017@...il.com>,
        <sharvari.harisangam@....com>, <huxinming820@...il.com>,
        <davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
        <pabeni@...hat.com>, <linux-wireless@...r.kernel.org>,
        <netdev@...r.kernel.org>
Subject: Re: [PATCH net v2] net: wireless: marvell: mwifiex: fix sleep in
 atomic context bugs

On 5/19/2022 5:08 PM, duoming@....edu.cn wrote:
> Hello,
> 
> On Thu, 19 May 2022 08:48:44 -0700 Jeff Johnson wrote:
> 
>>>>> There are sleep in atomic context bugs when uploading device dump
>>>>> data on usb interface. The root cause is that the operations that
>>>>> may sleep are called in fw_dump_timer_fn which is a timer handler.
>>>>> The call tree shows the execution paths that could lead to bugs:
>>>>>
>>>>>      (Interrupt context)
>>>>> fw_dump_timer_fn
>>>>>     mwifiex_upload_device_dump
>>>>>       dev_coredumpv(..., GFP_KERNEL)
>>
>> just looking at this description, why isn't the simple fix just to
>> change this call to use GFP_ATOMIC?
> 
> Because change the parameter of dev_coredumpv() to GFP_ATOMIC could only solve
> partial problem. The following GFP_KERNEL parameters are in /lib/kobject.c
> which is not influenced by dev_coredumpv().
> 
>   kobject_set_name_vargs
>     kvasprintf_const(GFP_KERNEL, ...); //may sleep
>     kstrdup(s, GFP_KERNEL); //may sleep

Then it seems there is a problem with dev_coredumpm().

dev_coredumpm() takes a gfp param which means it expects to be called in 
any context, but it then calls dev_set_name() which, as you point out, 
cannot be called from an atomic context.

So if we cannot change the fact that dev_set_name() cannot be called 
from an atomic context, then it would seem to follow that 
dev_coredumpv()/dev_coredumpm() also cannot be called from an atomic 
context and hence their gfp param is pointless and should presumably be 
removed.

/jeff

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ