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:   Mon, 23 May 2022 15:41:37 +0200
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Kalle Valo <kvalo@...nel.org>
Cc:     duoming@....edu.cn, linux-wireless@...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, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, rafael@...nel.org,
        Johannes Berg <johannes@...solutions.net>
Subject: Re: [PATCH v3] mwifiex: fix sleep in atomic context bugs caused by
 dev_coredumpv

On Mon, May 23, 2022 at 02:31:48PM +0300, Kalle Valo wrote:
> (adding Johannes)
> 
> duoming@....edu.cn writes:
> 
> >> > --- a/lib/kobject.c
> >> > +++ b/lib/kobject.c
> >> > @@ -254,7 +254,7 @@ int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
> >> >  	if (kobj->name && !fmt)
> >> >  		return 0;
> >> >  
> >> > -	s = kvasprintf_const(GFP_KERNEL, fmt, vargs);
> >> > +	s = kvasprintf_const(GFP_ATOMIC, fmt, vargs);
> >> >  	if (!s)
> >> >  		return -ENOMEM;
> >> >  
> >> > @@ -267,7 +267,7 @@ int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
> >> >  	if (strchr(s, '/')) {
> >> >  		char *t;
> >> >  
> >> > -		t = kstrdup(s, GFP_KERNEL);
> >> > +		t = kstrdup(s, GFP_ATOMIC);
> >> >  		kfree_const(s);
> >> >  		if (!t)
> >> >  			return -ENOMEM;
> >> 
> >> Please no, you are hurting the whole kernel because of one odd user.
> >> Please do not make these calls under atomic context.
> >
> > Thanks for your time and suggestions. I will remove the gfp_t
> > parameter of dev_coredumpv in order to show it could not be used in
> > atomic context.
> 
> In a way it would be nice to be able to call dev_coredump from atomic
> contexts, though I don't know how practical it actually is.

Dumping core information from atomic context feels very very wrong to
me.

Why not just not do that?

> Is there any other option? What about adding a gfp_t parameter to
> dev_set_name()? Or is there an alternative for dev_set_name() which
> can be called in atomic contexts?

dev_set_name() should not be called in atomic context as that implies
you are doing a very slow operation with locks disabled, not a good
thing at all.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ