Re: [PATCH -next] mm/memory: fix null pointer dereference in fault_dirty_shared_page
From: Lorenzo Stoakes
Date: Mon Jul 07 2025 - 08:32:57 EST
On Mon, Jul 07, 2025 at 02:27:01PM +0200, David Hildenbrand wrote:
> IIRC, MAP_ANON |MAP_SHARED would have done a shmem_zero_setup().
>
> mm/mmap.c still has the comment "mmap_region() will call shmem_zero_setup()
> to create a file".
Correct.
>
> I think this was moved to __mmap_new_vma().
>
> Is there any (error) path where we could not call that by accident?
No.
Shared means there's a file.
This also would mean we've been kernel NULL pointer dereferencing since
2019 btw when this change was made. I don't recall the reports... :>)
I think people get confused because MAP_SHARED | MAP_ANON makes people
think there won't be a file.
Our terminology sucks...
>
> --
> Cheers,
>
> David / dhildenb
>