[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANN689HJoFxU+EhbtxEDXWngQqJzc-8LE0erWKVyLQ9wXuZK4w@mail.gmail.com>
Date: Wed, 30 Sep 2020 16:22:00 -0700
From: Michel Lespinasse <walken@...gle.com>
To: Jann Horn <jannh@...gle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-mm <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>,
"Eric W . Biederman" <ebiederm@...ssion.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Sakari Ailus <sakari.ailus@...ux.intel.com>
Subject: Re: [PATCH 2/4] binfmt_elf: Take the mmap lock around find_extend_vma()
On Tue, Sep 29, 2020 at 6:20 PM Jann Horn <jannh@...gle.com> wrote:
> create_elf_tables() runs after setup_new_exec(), so other tasks can
> already access our new mm and do things like process_madvise() on it.
> (At the time I'm writing this commit, process_madvise() is not in mainline
> yet, but has been in akpm's tree for some time.)
>
> While I believe that there are currently no APIs that would actually allow
> another process to mess up our VMA tree (process_madvise() is limited to
> MADV_COLD and MADV_PAGEOUT, and uring and userfaultfd cannot reach an mm
> under which no syscalls have been executed yet), this seems like an
> accident waiting to happen.
>
> Let's make sure that we always take the mmap lock around GUP paths as long
> as another process might be able to see the mm.
>
> (Yes, this diff looks suspicious because we drop the lock before doing
> anything with `vma`, but that's because we actually don't do anything with
> it apart from the NULL check.)
>
> Signed-off-by: Jann Horn <jannh@...gle.com>
Thanks for these cleanups :)
Acked-by: Michel Lespinasse <walken@...gle.com>
Powered by blists - more mailing lists