linux-stable/mm
Li Qiong 872f2c34ff mm/slub: avoid accessing metadata when pointer is invalid in object_err()
[ Upstream commit b4efccec8d ]

object_err() reports details of an object for further debugging, such as
the freelist pointer, redzone, etc. However, if the pointer is invalid,
attempting to access object metadata can lead to a crash since it does
not point to a valid object.

One known path to the crash is when alloc_consistency_checks()
determines the pointer to the allocated object is invalid because of a
freelist corruption, and calls object_err() to report it. The debug code
should report and handle the corruption gracefully and not crash in the
process.

In case the pointer is NULL or check_valid_pointer() returns false for
the pointer, only print the pointer value and skip accessing metadata.

Fixes: 81819f0fc8 ("SLUB core")
Cc: <stable@vger.kernel.org>
Signed-off-by: Li Qiong <liqiong@nfschina.com>
Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
[ struct page + print_page_info() ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-09-09 18:43:59 +02:00
..
kasan
backing-dev.c
balloon_compaction.c
cleancache.c
cma_debug.c
cma.c
cma.h
compaction.c mm, vmscan: prevent infinite loop for costly GFP_NOIO | __GFP_RETRY_MAYFAIL allocations 2024-04-13 12:51:34 +02:00
debug_page_ref.c
debug.c
dmapool.c
early_ioremap.c
fadvise.c
failslab.c
filemap.c mm: drop the assumption that VM_SHARED always implies writable 2025-08-28 16:21:36 +02:00
frame_vector.c
frontswap.c
gup_benchmark.c
gup.c
highmem.c
hmm.c mm/hmm: move pmd_to_hmm_pfn_flags() to the respective #ifdeffery 2025-08-28 16:21:34 +02:00
huge_memory.c mm/huge_memory: fix dereferencing invalid pmd migration entry 2025-06-27 11:02:58 +01:00
hugetlb_cgroup.c
hugetlb.c
hwpoison-inject.c
init-mm.c
internal.h
interval_tree.c
Kconfig
Kconfig.debug
khugepaged.c mm/khugepaged: fix ->anon_vma race 2025-09-09 18:43:59 +02:00
kmemleak-test.c
kmemleak.c mm/kmemleak: avoid deadlock by moving pr_warn() outside kmemleak_lock 2025-08-28 16:21:34 +02:00
ksm.c
list_lru.c
maccess.c
madvise.c mm: drop the assumption that VM_SHARED always implies writable 2025-08-28 16:21:36 +02:00
Makefile
memblock.c
memcontrol.c memcg: always call cond_resched() after fn() 2025-06-04 14:32:35 +02:00
memfd.c
memory_hotplug.c
memory-failure.c mm/memory-failure: fix an incorrect use of tail pages 2024-04-13 12:51:31 +02:00
memory.c mm: avoid leaving partial pfn mappings around in error case 2024-11-17 14:58:53 +01:00
mempolicy.c
mempool.c
memremap.c
memtest.c memtest: use {READ,WRITE}_ONCE in memory scanning 2024-04-13 12:51:27 +02:00
migrate.c mm/migrate: set swap entry values of THP tail pages properly. 2024-04-13 12:51:31 +02:00
mincore.c
mlock.c
mm_init.c
mmap.c mm: perform the mapping_map_writable() check after call_mmap() 2025-08-28 16:21:36 +02:00
mmu_context.c
mmu_gather.c
mmu_notifier.c
mmzone.c
mprotect.c
mremap.c
msync.c
nommu.c
oom_kill.c memcg: fix soft lockup in the OOM process 2025-03-13 12:43:21 +01:00
page_alloc.c mm/page_alloc.c: avoid infinite retries caused by cpuset race 2025-06-04 14:32:36 +02:00
page_counter.c
page_ext.c
page_idle.c
page_io.c
page_isolation.c
page_owner.c
page_poison.c
page_vma_mapped.c
page-writeback.c mm: fix ratelimit_pages update error in dirty_ratio_handler() 2025-06-27 11:02:52 +01:00
pagewalk.c
percpu-internal.h
percpu-km.c
percpu-stats.c
percpu-vm.c
percpu.c
pgtable-generic.c
process_vm_access.c
readahead.c
rmap.c
rodata_test.c
shmem.c mm: update memfd seal write check to include F_SEAL_WRITE 2025-08-28 16:21:36 +02:00
shuffle.c
shuffle.h
slab_common.c mm: krealloc: Fix MTE false alarm in __do_krealloc 2024-11-08 16:20:54 +01:00
slab.c
slab.h
slob.c
slub.c mm/slub: avoid accessing metadata when pointer is invalid in object_err() 2025-09-09 18:43:59 +02:00
sparse-vmemmap.c
sparse.c
swap_cgroup.c
swap_slots.c
swap_state.c
swap.c
swapfile.c mm/swapfile: skip HugeTLB pages for unuse_vma 2024-11-08 16:20:47 +01:00
truncate.c
usercopy.c
userfaultfd.c userfaultfd: fix mmap_changing checking in mfill_atomic_hugetlb 2024-03-01 13:13:33 +01:00
util.c mm: only enforce minimum stack gap size if it's sensible 2024-11-08 16:20:35 +01:00
vmacache.c
vmalloc.c
vmpressure.c
vmscan.c mm: add missing release barrier on PGDAT_RECLAIM_LOCKED unlock 2025-05-02 07:39:16 +02:00
vmstat.c
workingset.c
z3fold.c
zbud.c
zpool.c
zsmalloc.c mm/zsmalloc: do not pass __GFP_MOVABLE if CONFIG_COMPACTION=n 2025-08-28 16:21:33 +02:00
zswap.c