[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180326212944.GF2236@uranus>
Date: Tue, 27 Mar 2018 00:29:44 +0300
From: Cyrill Gorcunov <gorcunov@...il.com>
To: Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>
Cc: Matthew Wilcox <willy@...radead.org>,
Yang Shi <yang.shi@...ux.alibaba.com>, adobriyan@...il.com,
mhocko@...nel.org, mguzik@...hat.com, akpm@...ux-foundation.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [v2 PATCH] mm: introduce arg_lock to protect arg_start|end and
env_start|end in mm_struct
On Tue, Mar 27, 2018 at 06:10:09AM +0900, Tetsuo Handa wrote:
> On 2018/03/27 4:21, Cyrill Gorcunov wrote:
> > That said I think using read-lock here would be a bug.
>
> If I understand correctly, the caller can't set both fields atomically, for
> prctl() does not receive both fields at one call.
>
> prctl(PR_SET_MM, PR_SET_MM_ARG_START xor PR_SET_MM_ARG_END xor PR_SET_MM_ENV_START xor PR_SET_MM_ENV_END, new value, 0, 0);
>
True, but the key moment is that two/three/four system calls can
run simultaneously. And while previously they are ordered by "write",
with read lock they are completely unordered and this is really
worries me. To be fair I would prefer to drop this old per-field
interface completely. This per-field interface was rather an ugly
solution from my side.
> Then, I wonder whether reading arg_start|end and env_start|end atomically makes
> sense. Just retry reading if arg_start > env_end or env_start > env_end is fine?
Tetsuo, let me re-read this code tomorrow, maybe I miss something obvious.
Powered by blists - more mailing lists