linux/lib
Matthew Wilcox (Oracle) b9c0e49abf mm: decline to manipulate the refcount on a slab page
Slab pages now have a refcount of 0, so nobody should be trying to
manipulate the refcount on them.  Doing so has little effect; the object
could be freed and reallocated to a different purpose, although the slab
itself would not be until the refcount was put making it behave rather
like TYPESAFE_BY_RCU.

Unfortunately, __iov_iter_get_pages_alloc() does take a refcount.  Fix
that to not change the refcount, and make put_page() silently not change
the refcount.  get_page() warns so that we can fix any other callers that
need to be changed.

Long-term, networking needs to stop taking a refcount on the pages that it
uses and rely on the caller to hold whatever references are necessary to
make the memory stable.  In the medium term, more page types are going to
hav a zero refcount, so we'll want to move get_page() and put_page() out
of line.

Link: https://lkml.kernel.org/r/20250310143544.1216127-1-willy@infradead.org
Fixes: 9aec2fb0fd (slab: allocate frozen pages)
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reported-by: Hannes Reinecke <hare@suse.de>
Closes: https://lore.kernel.org/all/08c29e4b-2f71-4b6d-8046-27e407214d8c@suse.com/
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2025-03-16 17:40:26 -07:00
..
842 move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
crypto crypto: lib/aesgcm - Reduce stack usage in libaesgcm_init 2024-12-28 19:49:22 +08:00
dim dim: pass dim_sample to net_dim() by reference 2024-11-03 12:36:54 -08:00
fonts drm/log: select CONFIG_FONT_SUPPORT 2024-12-12 18:26:32 +01:00
kunit linux_kselftest-kunit-6.14-rc1 2025-01-22 12:32:39 -08:00
lz4 include/linux/lz4.h: add some missing macros 2025-01-24 22:47:28 -08:00
lzo move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
math lib/math: add int_sqrt test suite 2025-01-12 20:21:08 -08:00
pldmfw pldmfw: enable selected component update 2025-01-16 13:04:41 -08:00
raid6
reed_solomon
test_fortify
tests selftests: kallsyms: fix and clarify current test boundaries 2024-11-28 11:17:30 -08:00
vdso
xz move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
zlib_deflate
zlib_dfltcc
zlib_inflate
zstd move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
.gitignore
Kconfig lib/crc32: remove other generic implementations 2025-01-29 09:10:35 -08:00
Kconfig.debug Documentation: fix doc link to fault-injection.rst 2025-03-05 21:36:13 -08:00
Kconfig.kasan kasan: delete CONFIG_KASAN_MODULE_TEST 2024-11-11 00:26:44 -08:00
Kconfig.kcsan
Kconfig.kfence
Kconfig.kgdb Documentation: move dev-tools debugging files to process/debugging/ 2024-12-17 13:46:53 -07:00
Kconfig.kmsan
Kconfig.ubsan
Makefile revert "xarray: port tests to kunit" 2025-02-01 03:53:28 -08:00
alloc_tag.c The various patchsets are summarized below. Plus of course many 2025-01-26 18:36:23 -08:00
argv_split.c
ashldi3.c
ashrdi3.c
asn1_decoder.c
asn1_encoder.c
assoc_array.c
atomic64.c atomic64: Use arch_spin_locks instead of raw_spin_locks 2025-01-22 15:07:01 -05:00
atomic64_test.c
audit.c
base64.c
bcd.c
bch.c
bitfield_kunit.c
bitmap-str.c
bitmap.c
bitrev.c
bootconfig-data.S
bootconfig.c
bsearch.c
btree.c
bucket_locks.c
bug.c
build_OID_registry
buildid.c lib/buildid: Handle memfd_secret() files in build_id_parse() 2024-10-17 21:30:32 +02:00
bust_spinlocks.c
check_signature.c
checksum.c net: checksum: Move from32to16() to generic header 2024-10-30 15:29:59 +01:00
checksum_kunit.c
closure.c
clz_ctz.c
clz_tab.c
cmdline.c
cmdline_kunit.c
cmpdi2.c
cmpxchg-emu.c
codetag.c alloc_tag: support for page allocation tag compression 2024-11-07 14:25:16 -08:00
compat_audit.c
cpu_rmap.c
cpumask.c mm/memblock: add memblock_alloc_or_panic interface 2025-01-25 20:22:38 -08:00
cpumask_kunit.c
crc-ccitt.c
crc-itu-t.c
crc-t10dif.c lib/crc-t10dif: stop wrapping the crypto API 2024-12-01 17:23:13 -08:00
crc4.c
crc7.c
crc8.c
crc16.c
crc32.c lib/crc32: remove other generic implementations 2025-01-29 09:10:35 -08:00
crc64-rocksoft.c
crc64.c
crc_kunit.c lib/crc_kunit.c: add KUnit test suite for CRC library functions 2024-12-01 17:23:13 -08:00
ctype.c
debug_info.c
debug_locks.c
debugobjects.c debugobjects: Track object usage to avoid premature freeing of objects 2024-10-15 17:30:33 +02:00
dec_and_lock.c
decompress.c
decompress_bunzip2.c
decompress_inflate.c
decompress_unlz4.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
decompress_unlzma.c
decompress_unlzo.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
decompress_unxz.c
decompress_unzstd.c
devmem_is_allowed.c
devres.c lib: devres: Simplify API devm_ioport_unmap() implementation 2024-10-14 08:21:09 +02:00
dhry.h
dhry_1.c
dhry_2.c
dhry_run.c
digsig.c
dump_stack.c
dynamic_debug.c
dynamic_queue_limits.c dql: annotate data-races around dql->last_obj_cnt 2024-10-31 19:19:36 -07:00
earlycpio.c
errname.c
error-inject.c
errseq.c
extable.c
fault-inject-usercopy.c
fault-inject.c fault-inject: use prandom where cryptographically secure randomness is not needed 2025-01-12 20:21:00 -08:00
fdt.c
fdt_addresses.c
fdt_empty_tree.c
fdt_ro.c
fdt_rw.c
fdt_strerror.c
fdt_sw.c
fdt_wip.c
find_bit.c
find_bit_benchmark.c
flex_proportions.c
fortify_kunit.c
fw_table.c
gen_crc32table.c lib/crc32: remove other generic implementations 2025-01-29 09:10:35 -08:00
gen_crc64table.c
genalloc.c
generic-radix-tree.c
glob.c
globtest.c
group_cpus.c
hashtable_test.c
hexdump.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
hweight.c
idr.c
inflate.c lib/inflate.c: remove dead code 2025-01-12 20:21:15 -08:00
interval_tree.c
interval_tree_test.c lib/interval_tree_test.c: Include <linux/prandom.h> instead of <linux/random.h> 2024-10-03 18:20:12 +02:00
iomap.c
iomap_copy.c
iomem_copy.c lib/iomem_copy: fix kerneldoc format style 2024-10-29 07:14:29 +00:00
iommu-helper.c
iov_iter.c mm: decline to manipulate the refcount on a slab page 2025-03-16 17:40:26 -07:00
irq_poll.c
irq_regs.c
is_signed_type_kunit.c
is_single_threaded.c
kasprintf.c
kfifo.c
klist.c
kobject.c kobject: Remove unused functions 2025-01-14 19:45:35 +01:00
kobject_uevent.c
kstrtox.c
kstrtox.h
kunit_iov_iter.c The various patchsets are summarized below. Plus of course many 2025-01-26 18:36:23 -08:00
linear_ranges.c
list-test.c list: test: check the size of every lists for list_cut_position*() 2024-11-05 17:12:30 -08:00
list_debug.c lib/list_debug.c: add object information in case of invalid object 2025-01-25 20:22:23 -08:00
list_sort.c lib/list_sort: clarify comparison function requirements in list_sort() 2025-01-24 22:47:23 -08:00
llist.c
locking-selftest-hardirq.h
locking-selftest-mutex.h
locking-selftest-rlock-hardirq.h
locking-selftest-rlock-softirq.h
locking-selftest-rlock.h
locking-selftest-rsem.h
locking-selftest-rtmutex.h
locking-selftest-softirq.h
locking-selftest-spin-hardirq.h
locking-selftest-spin-softirq.h
locking-selftest-spin.h
locking-selftest-wlock-hardirq.h
locking-selftest-wlock-softirq.h
locking-selftest-wlock.h
locking-selftest-wsem.h
locking-selftest.c locking/ww_mutex: Fix ww_mutex dummy lockdep map selftest warnings 2024-12-02 12:16:57 +01:00
lockref.c lockref: use bool for false/true returns 2025-01-16 11:48:11 +01:00
logic_iomem.c
logic_pio.c logic_pio: Constify fwnode_handle 2024-10-14 16:33:24 -05:00
lru_cache.c
lshrdi3.c
lwq.c
maple_tree.c maple_tree: only root node could be deficient 2025-01-13 22:40:41 -08:00
memcat_p.c
memcpy_kunit.c
memory-notifier-error-inject.c
memregion.c
memweight.c
min_heap.c lib/min_heap: introduce non-inline versions of min heap API functions 2024-11-05 17:12:34 -08:00
muldi3.c
net_utils.c
netdev-notifier-error-inject.c
nlattr.c
nmi_backtrace.c
notifier-error-inject.c
notifier-error-inject.h
objagg.c
objpool.c objpool: fix to make percpu slot allocation more robust 2024-11-07 14:14:58 -08:00
of-reconfig-notifier-error-inject.c
oid_registry.c
once.c
overflow_kunit.c Compiler Attributes: disable __counted_by for clang < 19.1.3 2024-11-19 08:48:27 -08:00
packing.c lib: packing: add pack_fields() and unpack_fields() 2024-12-11 20:13:00 -08:00
packing_test.c lib: packing: add pack_fields() and unpack_fields() 2024-12-11 20:13:00 -08:00
parman.c
parser.c Documentation: core-api: add generic parser docbook 2024-12-11 09:07:40 -07:00
percpu-refcount.c
percpu_counter.c
percpu_test.c percpu: add a test case for the specific 64-bit value addition 2024-11-06 20:11:14 -08:00
plist.c
pm-notifier-error-inject.c
polynomial.c
radix-tree.c
radix-tree.h
random32.c Random number generator updates for Linux 6.13-rc1. 2024-11-19 10:43:44 -08:00
ratelimit.c
rbtree.c
rbtree_test.c lib/rbtree-test: Include <linux/prandom.h> instead of <linux/random.h> 2024-10-03 18:20:19 +02:00
rcuref.c rcuref: Plug slowpath race in rcuref_put() 2025-01-29 15:21:31 +01:00
ref_tracker.c
refcount.c
rhashtable.c Mainly individually changelogged singleton patches. The patch series in 2025-01-26 17:50:53 -08:00
sbitmap.c
scatterlist.c lib/scatterlist: use sg_phys() helper 2024-11-05 17:12:40 -08:00
seq_buf.c
sg_pool.c
sg_split.c
siphash.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
siphash_kunit.c
slub_kunit.c mm/slub, kunit: Add testcase for krealloc redzone and zeroing 2024-11-16 21:19:39 +01:00
smp_processor_id.c
sort.c lib/sort: clarify comparison function requirements in sort_r() 2025-01-24 22:47:23 -08:00
stackdepot.c stackdepot: fix stack_depot_save_flags() in NMI context 2024-12-05 19:54:45 -08:00
stackinit_kunit.c stackinit: Fix comment for test_small_end 2025-02-06 11:36:25 -08:00
stmp_device.c
string.c strscpy: write destination buffer only once 2024-12-01 12:17:16 -08:00
string_helpers.c lib: string_helpers: silence snprintf() output truncation warning 2024-11-02 13:08:55 -07:00
string_helpers_kunit.c
string_kunit.c
strncpy_from_user.c kasan: move checks to do_strncpy_from_user 2024-11-11 00:26:43 -08:00
strnlen_user.c
syscall.c
test-kstrtox.c
test_bitmap.c
test_bitops.c
test_bits.c
test_blackhole_dev.c
test_bpf.c bpf/tests: Add 32 bits only long conditional jump tests 2025-01-06 16:10:19 +01:00
test_debug_virtual.c
test_dynamic_debug.c
test_firmware.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
test_fprobe.c fprobe: Rewrite fprobe on function-graph tracer 2024-12-26 10:50:05 -05:00
test_fpu.h
test_fpu_glue.c
test_fpu_impl.c
test_free_pages.c
test_hash.c
test_hexdump.c
test_hmm.c
test_hmm_uapi.h
test_ida.c
test_kmod.c
test_kprobes.c
test_linear_ranges.c
test_list_sort.c
test_lockup.c
test_maple_tree.c test_maple_tree: test exhausted upper limit of mtree_alloc_cyclic() 2025-01-25 20:22:19 -08:00
test_memcat_p.c
test_meminit.c
test_min_heap.c lib/test_min_heap: use inline min heap variants to reduce attack vector 2025-01-12 20:20:57 -08:00
test_module.c
test_objagg.c
test_objpool.c lib: test_objpool: Use kthread_run_on_cpu() 2025-01-02 22:12:12 +01:00
test_parman.c lib/test_parman: Include <linux/prandom.h> instead of <linux/random.h> 2024-10-03 18:20:27 +02:00
test_printf.c printf: Add print format (%pra) for struct range 2024-10-28 14:32:43 -07:00
test_ref_tracker.c
test_rhashtable.c
test_scanf.c lib/test_scanf: Include <linux/prandom.h> instead of <linux/random.h> 2024-10-03 18:20:29 +02:00
test_sort.c
test_static_key_base.c
test_static_keys.c
test_sysctl.c treewide: const qualify ctl_tables where applicable 2025-01-28 13:48:37 +01:00
test_ubsan.c
test_uuid.c
test_vmalloc.c mm: alloc_pages_bulk: rename API 2025-01-25 20:22:31 -08:00
test_xarray.c test_xarray: fix failure in check_pause when CONFIG_XARRAY_MULTI is not defined 2025-02-17 22:40:04 -08:00
textsearch.c
timerqueue.c
trace_readwrite.c
ts_bm.c
ts_fsm.c
ts_kmp.c
ubsan.c
ubsan.h
ucmpdi2.c
ucs2_string.c
union_find.c
usercopy.c
usercopy_kunit.c
util_macros_kunit.c lib: util_macros_kunit: add kunit test for util_macros.h 2024-11-11 17:17:05 -08:00
uuid.c
vsprintf.c vsnprintf: fix the number base for non-numeric formats 2025-01-13 08:23:28 -08:00
win_minmax.c rxrpc: Generate rtt_min 2024-12-09 13:48:29 -08:00
xarray.c Xarray: use xa_mark_t in xas_squash_marks() to keep code consistent 2025-01-24 22:47:28 -08:00
xxhash.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00