[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAG48ez1=dLpebzSNu+8_kOfbVLySXZF44nmr+TU5m4cUjg0MBA@mail.gmail.com>
Date: Mon, 5 Dec 2022 15:53:09 +0100
From: Jann Horn <jannh@...gle.com>
To: Liam Howlett <liam.howlett@...cle.com>
Cc: Linux-MM <linux-mm@...ck.org>,
Andrew Morton <akpm@...ux-foundation.org>,
kernel list <linux-kernel@...r.kernel.org>,
Jason Donenfeld <Jason@...c4.com>, Yu Zhao <yuzhao@...gle.com>,
"Matthew Wilcox (Oracle)" <willy@...radead.org>,
SeongJae Park <sj@...nel.org>, Vlastimil Babka <vbabka@...e.cz>
Subject: Re: brk() in v6.1-rc1 can expand file mappings, seemingly without
taking file locks
On Mon, Dec 5, 2022 at 3:50 PM Liam Howlett <liam.howlett@...cle.com> wrote:
> * Jann Horn <jannh@...gle.com> [221202 13:54]:
> > As of commit ca57f02295f, brk() can expand ordinary file mappings (but
> > not file mappings with weird flags), and I think it does it with
> > insufficient locks. I think brk() probably needs some extra checks to
> > make sure it's operating on a brk-like VMA (which means it should at
> > least be anonymous, and perhaps pass the full can_vma_merge_after()
> > check so that we're not creating unnecessary special cases?).
>
>
> Thanks. This is probably caused by commit 2e7ce7d354f2: "mm/mmap:
> change do_brk_flags() to expand existing VMA and add do_brk_munmap()"
Yeah.
> Specifically the checks around expanding the VMA.
>
> > user@vm:~/brk_stretch$ cat brk_file.c
>
> Thanks for the testcase. I have a fix that I'm testing, but it's worth
> noting that the brk call will succeed - except a new VMA will be
> created. Is this what you expect?
Yes, that's what I would expect.
Powered by blists - more mailing lists