[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20181106082221.GB27423@dhcp22.suse.cz>
Date: Tue, 6 Nov 2018 09:22:21 +0100
From: Michal Hocko <mhocko@...nel.org>
To: Rasmus Villemoes <linux@...musvillemoes.dk>
Cc: Kees Cook <keescook@...omium.org>,
Jordan Crouse <jcrouse@...eaurora.org>,
LKML <linux-kernel@...r.kernel.org>,
Linux-MM <linux-mm@...ck.org>
Subject: Re: kstrdup_quotable_cmdline and gfp flags
On Mon 05-11-18 22:32:07, Rasmus Villemoes wrote:
> kstrdup_quotable_cmdline takes gfp flags and passes those on to
> kstrdup_quotable, but before that it has done a kmalloc(PAGE_SIZE) with
> a hard-coded GFP_KERNEL. There is one caller of kstrdup_quotable_cmdline
> which passes GFP_ATOMIC, and the commit introducing that (65a3c2748e)
> conveniently has this piece of history:
>
> v2: Use GFP_ATOMIC while holding the rcu lock per Chris Wilson
>
> So, should the GFP_KERNEL in kstrdup_quotable_cmdline simply be changed
> to use the passed-in gfp, or is there some deeper reason for the
> GFP_KERNEL (in which case it doesn't really make sense to take gfp at
> all...)?
I would just drop the gfp argument and move comm = kstrdup(task->comm, GFP_ATOMIC);
before rcu read lock
The code in its current form is buggy.
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists