lkml.org 
[lkml]   [2022]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.

\
 
 \ /
  Last update: 2022-10-18 21:59    [W:0.156 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site