linux/Documentation/core-api
David Howells c8070b7875 mm: Don't pin ZERO_PAGE in pin_user_pages()
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>
2023-05-31 09:48:15 -06: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 x86 documentation into Documentation/arch/ 2023-03-30 12:58:51 -06:00
assoc_array.rst Documentation: Use "while" instead of "whilst" 2018-11-20 09:30:43 -07:00
boot-time-mm.rst docs/boot-time-mm: remove bootmem documentation 2018-10-31 08:54:16 -07:00
cachetlb.rst mm: Add flush_dcache_folio() 2021-10-18 07:49:36 -04:00
circular-buffers.rst doc: Remove ".vnet" from paulmck email addresses 2019-05-28 09:02:57 -07:00
cpu_hotplug.rst Remove duplicate words inside documentation 2022-09-27 13:21:43 -06:00
debug-objects.rst doc: debugobjects: actually pull in the kerneldoc comments 2016-11-29 14:44:14 -07:00
debugging-via-ohci1394.rst docs: debugging-via-ohci1394.txt: add it to the core-api book 2020-05-15 11:59:17 -06:00
dma-api-howto.rst dma-api-howto: typo fix 2023-04-10 16:46:11 -06:00
dma-api.rst docs/mm: Physical Memory: remove useless markup 2023-02-02 10:18:04 -07:00
dma-attributes.rst Reinstate some of "swiotlb: rework "fix info leak with DMA_FROM_DEVICE"" 2022-03-28 11:37:05 -07:00
dma-isa-lpc.rst docs: core-api: avoid using ReST :doc:foo markup 2021-06-17 13:24:37 -06:00
entry.rst Documentation: core-api: entry: Add comments about nesting 2022-01-27 11:32:40 -07:00
errseq.rst errseq: Add to documentation tree 2018-01-01 12:40:27 -07:00
genalloc.rst lib/genalloc.c: rename addr_in_gen_pool to gen_pool_has_addr 2019-12-04 19:44:13 -08:00
generic-radix-tree.rst generic radix trees 2019-03-12 10:04:02 -07:00
genericirq.rst docs: genericirq.rst: don't document chip.c functions twice 2020-10-15 07:49:41 +02:00
gfp_mask-from-fs-io.rst docs: core-api/gfp_mask-from-fs-io: add a label for cross-referencing 2018-09-20 11:02:32 -06:00
idr.rst IDR: Note that the IDR API is deprecated 2022-07-10 21:17:30 -04:00
index.rst docs: add more netlink docs (incl. spec docs) 2023-01-24 10:58:11 +01:00
kernel-api.rst module: add debug stats to help identify memory pressure 2023-04-18 11:15:24 -07:00
kobject.rst kobject documentation: remove default_attrs information 2022-01-07 11:23:37 +01:00
kref.rst docs: move the kref doc into the core-api book 2020-05-15 12:02:19 -06:00
librs.rst docs-rst: convert librs book to ReST 2017-05-16 08:44:16 -03:00
local_ops.rst timers: Update the documentation to reflect on the new timer_shutdown() API 2022-11-24 15:09:12 +01:00
maple_tree.rst Maple Tree: add new data structure 2022-09-26 19:46:13 -07:00
memory-allocation.rst mm/slab: document kfree() as allowed for kmem_cache_alloc() objects 2023-03-29 10:35:41 +02:00
memory-hotplug.rst mm/memory_hotplug: remove HIGHMEM leftovers 2021-11-06 13:30:42 -07:00
mm-api.rst mm/page_alloc: remove obsolete gfpflags_normal_context() 2022-10-03 14:03:30 -07:00
netlink.rst docs: add more netlink docs (incl. spec docs) 2023-01-24 10:58:11 +01:00
packing.rst Documentation: core-api: packing: correct spelling 2023-02-15 21:40:54 -08:00
padata.rst Documentation: core-api: padata: correct spelling 2023-02-16 16:58:01 -07:00
pin_user_pages.rst mm: Don't pin ZERO_PAGE in pin_user_pages() 2023-05-31 09:48:15 -06:00
printk-basics.rst printk: Move the printk() kerneldoc comment to its new home 2021-07-26 12:36:44 +02:00
printk-formats.rst mm, printk: introduce new format %pGt for page_type 2023-03-28 16:20:09 -07: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 docs: rbtree.rst: Fix a typo 2021-03-25 11:38:51 -06:00
refcount-vs-atomic.rst docs: remove :c:func: from refcount-vs-atomic.rst 2019-10-07 09:08:56 -06:00
symbol-namespaces.rst doc: module: update file references 2022-07-01 14:50:01 -07:00
this_cpu_ops.rst docs: move other kAPI documents to core-api 2020-06-26 11:33:42 -06:00
timekeeping.rst timekeeping: Introduce fast accessor to clock tai 2022-04-14 16:19:30 +02:00
tracepoint.rst doc: Sphinxify the tracepoint docbook 2016-11-29 14:44:23 -07:00
unaligned-memory-access.rst docs: move other kAPI documents to core-api 2020-06-26 11:33:42 -06:00
watch_queue.rst Documentation: move watch_queue to core-api 2022-04-22 09:47:25 -06:00
workqueue.rst docs: ftrace: always use canonical ftrace path 2023-01-31 14:02:30 -07:00
xarray.rst XArray: Document the locking requirement for the xa_state 2022-02-03 15:56:50 -05:00