linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: David Hildenbrand <david@redhat.com>
Cc: Liam Howlett <liam.howlett@oracle.com>,
	"maple-tree@lists.infradead.org" <maple-tree@lists.infradead.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Liu Zixian <liuzixian4@huawei.com>,
	Jason Gunthorpe <jgg@nvidia.com>,
	Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH] mm/mmap: Fix MAP_FIXED address return on VMA merge
Date: Tue, 18 Oct 2022 20:58:28 +0100	[thread overview]
Message-ID: <Y08FZMg1Kgr++o5D@casper.infradead.org> (raw)
In-Reply-To: <3da4244a-5a1b-cf34-bf5c-22c199b15cb6@redhat.com>

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.


  reply	other threads:[~2022-10-18 19:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-18 19:17 Liam Howlett
2022-10-18 19:27 ` David Hildenbrand
2022-10-18 19:58   ` Matthew Wilcox [this message]
2022-10-18 20:25   ` Liam Howlett
2022-10-19 14:08     ` David Hildenbrand

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=Y08FZMg1Kgr++o5D@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=liam.howlett@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=liuzixian4@huawei.com \
    --cc=maple-tree@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    /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