[PATCH RESEND v2 19/23] proc: pin the entry around the vm_operations of its mappings
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Thu Nov 5 11:35:52 PST 2026
> proc_reg_mmap() pins the entry around ->proc_mmap() and that's it. What
> the entry hands out lives on without the pin: the vm_operations it put
> on the mapping run on every fault, on every write to a read-only page
> and on every ptrace access with the entry unpinned, and the mapping
> itself survives remove_proc_entry(). For /proc/vmcore that means the
> fault handler runs after vmcore_cleanup() freed what it looks at, and a
> mapping of the old memory keeps pointing at it after fadump gave that
> memory back to the page allocator. /proc/bus/pci has the same problem
> when a device goes away.
>
> So do what kernfs does for the mappings of sysfs files. procfs puts
> vm_operations of its own on the mapping. They pin the entry around its
> ->open(), ->fault(), ->page_mkwrite() and ->access() and fail with
> SIGBUS, or do nothing, once the entry is gone. The entry's
> vm_operations are kept in its open node, so every mapping of an entry
> [ ... ]
> window.
>
> Entries that are never removed aren't wrapped, procfs never pins them.
>
> Signed-off-by: Christian Brauner (Amutable) <brauner at kernel.org>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261104-work-procfs-core-v2-0-76ace653a773@kernel.org?part=19
More information about the kexec
mailing list