linux-yocto/Documentation/core-api
David Howells 476c1dfefa mm: Don't pin ZERO_PAGE in pin_user_pages()
[ Upstream commit c8070b7875 ]

Make pin_user_pages*() leave a ZERO_PAGE unpinned if it extracts a pointer
to it from the page tables and make unpin_user_page*() correspondingly
ignore a ZERO_PAGE when unpinning.  We don't want to risk overrunning a
zero page's refcount as we're only allowed ~2 million pins on it -
something that userspace can conceivably trigger.

Add a pair of functions to test whether a page or a folio is a ZERO_PAGE.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Christoph Hellwig <hch@infradead.org>
cc: David Hildenbrand <david@redhat.com>
cc: Lorenzo Stoakes <lstoakes@gmail.com>
cc: Andrew Morton <akpm@linux-foundation.org>
cc: Jens Axboe <axboe@kernel.dk>
cc: Al Viro <viro@zeniv.linux.org.uk>
cc: Matthew Wilcox <willy@infradead.org>
cc: Jan Kara <jack@suse.cz>
cc: Jeff Layton <jlayton@kernel.org>
cc: Jason Gunthorpe <jgg@nvidia.com>
cc: Logan Gunthorpe <logang@deltatee.com>
cc: Hillf Danton <hdanton@sina.com>
cc: Christian Brauner <brauner@kernel.org>
cc: Linus Torvalds <torvalds@linux-foundation.org>
cc: linux-fsdevel@vger.kernel.org
cc: linux-block@vger.kernel.org
cc: linux-kernel@vger.kernel.org
cc: linux-mm@kvack.org
Reviewed-by: Lorenzo Stoakes <lstoakes@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: David Hildenbrand <david@redhat.com>
Link: https://lore.kernel.org/r/20230526214142.958751-2-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Stable-dep-of: bddf10d26e ("uprobes: Reject the shared zeropage in uprobe_write_opcode()")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-03-07 16:56:47 +01:00
..
irq Documentation: irqdomain: Fix typo of "at least once" 2022-08-18 11:11:52 -06:00
wrappers docs: put atomic*.txt and memory-barriers.txt into the core-api book 2022-09-29 12:55:06 -06:00
asm-annotations.rst docs: move asm-annotations.rst into core-api 2022-09-29 12:55:06 -06:00
assoc_array.rst
boot-time-mm.rst
cachetlb.rst
circular-buffers.rst
cpu_hotplug.rst Remove duplicate words inside documentation 2022-09-27 13:21:43 -06:00
debug-objects.rst
debugging-via-ohci1394.rst
dma-api-howto.rst arch/*/: remove CONFIG_VIRT_TO_BUS 2022-06-28 13:20:21 +02:00
dma-api.rst dma-mapping: add dma_opt_mapping_size() 2022-07-19 06:05:41 +02:00
dma-attributes.rst
dma-isa-lpc.rst
entry.rst
errseq.rst
genalloc.rst
generic-radix-tree.rst
genericirq.rst
gfp_mask-from-fs-io.rst
idr.rst IDR: Note that the IDR API is deprecated 2022-07-10 21:17:30 -04:00
index.rst - Yu Zhao's Multi-Gen LRU patches are here. They've been under test in 2022-10-10 17:53:04 -07:00
kernel-api.rst overflow: Fix kern-doc markup for functions 2022-10-25 14:57:42 -07:00
kobject.rst
kref.rst
librs.rst
local_ops.rst
maple_tree.rst Maple Tree: add new data structure 2022-09-26 19:46:13 -07:00
memory-allocation.rst
memory-hotplug.rst
mm-api.rst mm/page_alloc: remove obsolete gfpflags_normal_context() 2022-10-03 14:03:30 -07:00
packing.rst
padata.rst
pin_user_pages.rst mm: Don't pin ZERO_PAGE in pin_user_pages() 2025-03-07 16:56:47 +01:00
printk-basics.rst
printk-formats.rst vsprintf: add new %pA format specifier 2022-09-28 09:00:20 +02:00
printk-index.rst printk/index: Printk index feature documentation 2022-04-13 14:25:31 +02:00
protection-keys.rst Documentation/protection-keys: Clean up documentation for User Space pkeys 2022-06-07 16:06:22 -07:00
rbtree.rst
refcount-vs-atomic.rst
symbol-namespaces.rst doc: module: update file references 2022-07-01 14:50:01 -07:00
this_cpu_ops.rst
timekeeping.rst timekeeping: Introduce fast accessor to clock tai 2022-04-14 16:19:30 +02:00
tracepoint.rst
unaligned-memory-access.rst
watch_queue.rst Documentation: move watch_queue to core-api 2022-04-22 09:47:25 -06:00
workqueue.rst
xarray.rst