Messages in this thread | | | Date | Tue, 18 Oct 2022 20:58:28 +0100 | From | Matthew Wilcox <> | 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.
| |