[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190502205734.GE2488@uranus.lan>
Date: Thu, 2 May 2019 23:57:34 +0300
From: Cyrill Gorcunov <gorcunov@...il.com>
To: Michal Koutný <mkoutny@...e.com>
Cc: akpm@...ux-foundation.org, arunks@...eaurora.org, brgl@...ev.pl,
geert+renesas@...der.be, ldufour@...ux.ibm.com,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
mguzik@...hat.com, mhocko@...nel.org, rppt@...ux.ibm.com,
vbabka@...e.cz, ktkhai@...tuozzo.com
Subject: Re: [PATCH v3 2/2] prctl_set_mm: downgrade mmap_sem to read lock
On Thu, May 02, 2019 at 02:52:03PM +0200, Michal Koutný wrote:
> The commit a3b609ef9f8b ("proc read mm's {arg,env}_{start,end} with mmap
> semaphore taken.") added synchronization of reading argument/environment
> boundaries under mmap_sem. Later commit 88aa7cc688d4 ("mm: introduce
> arg_lock to protect arg_start|end and env_start|end in mm_struct")
> avoided the coarse use of mmap_sem in similar situations. But there
> still remained two places that (mis)use mmap_sem.
>
> get_cmdline should also use arg_lock instead of mmap_sem when it reads the
> boundaries.
>
> The second place that should use arg_lock is in prctl_set_mm. By
> protecting the boundaries fields with the arg_lock, we can downgrade
> mmap_sem to reader lock (analogous to what we already do in
> prctl_set_mm_map).
>
> v2: call find_vma without arg_lock held
> v3: squashed get_cmdline arg_lock patch
>
> Fixes: 88aa7cc688d4 ("mm: introduce arg_lock to protect arg_start|end and env_start|end in mm_struct")
> Cc: Yang Shi <yang.shi@...ux.alibaba.com>
> Cc: Mateusz Guzik <mguzik@...hat.com>
> CC: Cyrill Gorcunov <gorcunov@...il.com>
> Co-developed-by: Laurent Dufour <ldufour@...ux.ibm.com>
> Signed-off-by: Laurent Dufour <ldufour@...ux.ibm.com>
> Signed-off-by: Michal Koutný <mkoutny@...e.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@...il.com>
Powered by blists - more mailing lists