From: "Lorenzo Stoakes (ARM)" <ljs@kernel.org>
To: "David Hildenbrand (Arm)" <david@kernel.org>
Cc: Josef Bacik <josef@toxicpanda.com>,
Andrew Morton <akpm@linux-foundation.org>,
"Liam R. Howlett" <liam@infradead.org>,
Vlastimil Babka <vbabka@kernel.org>,
Jann Horn <jannh@google.com>, Pedro Falcato <pfalcato@suse.de>,
Muchun Song <muchun.song@linux.dev>,
Oscar Salvador <osalvador@suse.de>,
linux-mm@kvack.org
Subject: Re: [PATCH RFC 0/7] mm: let vm_ops->open() fail for hugetlb
Date: Tue, 1 Dec 2026 14:02:10 +0000 [thread overview]
Message-ID: <aw7QqCu3gQUCJzMr@gremlin> (raw)
In-Reply-To: <e95ddb9d-4608-44e4-8602-2b07ed656901@kernel.org>
On Sun, Nov 22, 2026 at 05:05:25PM +0100, David Hildenbrand (Arm) wrote:
> On 11/18/26 18:00, Josef Bacik wrote:
> > Hello,
> >
> > vm_ops->open() can't fail, so anything that allocates in it has to hide the
> > failure. hugetlb is the one I care about: if it can't allocate the VMA lock
> > for a shared mapping it carries on without one, and faults can then race
> > with truncation.
>
> I'll leave the final decision to VMA maintainers, but for me this is the right
> thing to do and I'm sure it will come handy in the future.
>
> (I have the faint recollection of people having to work around ->open not being
> able to fail in weird ways.
TL;DR - I'd like to take this over please :) Hope that works for you guys?
TL bit:
Thanks David. My inbox is a disaster so only just seeing this.
This is relevant to me as my mmap_prepare work is trying to fix up a bunch of
the mistakes we made around this stuff.
The fact that open() and close() don't return error codes is a HUGE issue. It is
clearly a mistake and results in all kinds of horrors.
Hugetlb is just doing everything wrong, as usual though. It is abusing the mmap
abstraction, it is abusing open/close it is abusing everything. It has problems
with it because it's a giant f'ing hack.
Anyway, this needs to be symmetrical - open and close both should return errors
and should both be fixed up to handle that.
It also needs to sit right with the mmap_prepare work.
I added vm_ops->mapped() which is sort of a 'first open' for mmap_prepare() that
_does_ return an error, but that serves a different purpose (mmap_prepare is
idempotent, if you need to allocate you should do it in vm_ops->mapped()).
Given this cycle is about fixes only I think I can defer it to next cycle. And
then maybe even try to put it through the VMA tree?
--
Cheers, Lorenzo
prev parent reply other threads:[~2026-12-01 14:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 17:00 [PATCH RFC 0/7] mm: let vm_ops->open() fail for hugetlb Josef Bacik
2026-11-18 17:00 ` [PATCH RFC 1/7] treewide: make vm_ops->open() return an int Josef Bacik
2026-11-18 17:00 ` [PATCH RFC 2/7] mm/vma: fail the split if vm_ops->open() fails Josef Bacik
2026-11-18 17:00 ` [PATCH RFC 3/7] mm/vma: fail copy_vma() " Josef Bacik
2026-11-18 17:00 ` [PATCH RFC 4/7] mm/nommu: fail the split " Josef Bacik
2026-11-18 17:00 ` [PATCH RFC 5/7] mm/mmap: fail the fork " Josef Bacik
2026-11-18 17:00 ` [PATCH RFC 6/7] mm/hugetlb: fail if the VMA lock can't be allocated Josef Bacik
2026-11-18 17:00 ` [PATCH RFC 7/7] tools/testing/vma: test a failing vm_ops->open() Josef Bacik
2026-11-22 16:05 ` [PATCH RFC 0/7] mm: let vm_ops->open() fail for hugetlb David Hildenbrand (Arm)
2026-12-01 14:02 ` Lorenzo Stoakes (ARM) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aw7QqCu3gQUCJzMr@gremlin \
--to=ljs@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=david@kernel.org \
--cc=jannh@google.com \
--cc=josef@toxicpanda.com \
--cc=liam@infradead.org \
--cc=linux-mm@kvack.org \
--cc=muchun.song@linux.dev \
--cc=osalvador@suse.de \
--cc=pfalcato@suse.de \
--cc=vbabka@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox