[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y08FZMg1Kgr++o5D@casper.infradead.org>
Date: Tue, 18 Oct 2022 20:58:28 +0100
From: Matthew Wilcox <willy@...radead.org>
To: David Hildenbrand <david@...hat.com>
Cc: Liam Howlett <liam.howlett@...cle.com>,
"maple-tree@...ts.infradead.org" <maple-tree@...ts.infradead.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Liu Zixian <liuzixian4@...wei.com>,
Jason Gunthorpe <jgg@...dia.com>,
Mark Rutland <mark.rutland@....com>
Subject: Re: [PATCH] mm/mmap: Fix MAP_FIXED address return on VMA merge
On Tue, Oct 18, 2022 at 09:27:11PM +0200, David Hildenbrand wrote:
> > + if (WARN_ON((addr != vma->vm_start))) {
> > + error = -EINVAL;
> > + goto close_and_free_vma;
> > + }
>
> If this is something that user space can trigger, WARN_* is the wrong
> choice. But what I understand from the comment change is that this must not
> happen at that point unless there is a real issue.
It's something that a device driver can trigger. So if userspace calls
mmap(MAP_FIXED) and the driver decides to overwrite the vma->vm_start,
it'll trigger. I think WARN_ON() is the right choice.
> Why not "if (WARN_ON_ONCE)" ?
Because by it's nature it's not going to trigger a bajillion times in
quick succession.
Powered by blists - more mailing lists