linux-stable/mm
Li Qiong f66012909e 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:45:22 +02:00
..
kasan
backing-dev.c
balloon_compaction.c
cleancache.c
cma_debug.c
cma.c
cma.h
compaction.c
debug_page_ref.c
debug_vm_pgtable.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:22:54 +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:22:38 +02:00
huge_memory.c mm/huge_memory: fix dereferencing invalid pmd migration entry 2025-06-27 11:04:24 +01:00
hugetlb_cgroup.c
hugetlb.c mm/hugetlb: fix huge_pmd_unshare() vs GUP-fast race 2025-06-27 11:04:21 +01:00
hwpoison-inject.c
init-mm.c
internal.h mm: unconditionally close VMAs on error 2024-12-14 19:47:40 +01:00
interval_tree.c
ioremap.c
Kconfig
Kconfig.debug
khugepaged.c mm/khugepaged: fix ->anon_vma race 2025-09-09 18:45:21 +02:00
kmemleak.c mm/kmemleak: avoid deadlock by moving pr_warn() outside kmemleak_lock 2025-08-28 16:22:48 +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:22:54 +02:00
Makefile
mapping_dirty_helpers.c
memblock.c
memcontrol.c memcg: always call cond_resched() after fn() 2025-06-04 14:37:08 +02:00
memfd.c mm: reinstate ability to map write-sealed memfd mappings read-only 2025-08-28 16:22:55 +02:00
memory_hotplug.c
memory-failure.c
memory.c mm: fix apply_to_existing_page_range() 2025-05-02 07:41:09 +02:00
mempolicy.c
mempool.c
memremap.c
memtest.c
migrate.c
mincore.c
mlock.c
mm_init.c
mmap.c mm: reinstate ability to map write-sealed memfd mappings read-only 2025-08-28 16:22:55 +02:00
mmu_gather.c
mmu_notifier.c
mmzone.c
mprotect.c
mremap.c
msync.c
nommu.c mm: refactor arch_calc_vm_flag_bits() and arm64 MTE handling 2024-12-14 19:47:40 +01:00
oom_kill.c memcg: fix soft lockup in the OOM process 2025-03-13 12:47:26 +01:00
page_alloc.c mm/page_alloc: detect allocation forbidden by cpuset and bail out early 2025-08-28 16:22:58 +02:00
page_counter.c
page_ext.c
page_idle.c
page_io.c
page_isolation.c
page_owner.c
page_poison.c
page_reporting.c
page_reporting.h
page_vma_mapped.c
page-writeback.c mm: fix ratelimit_pages update error in dirty_ratio_handler() 2025-06-27 11:04:14 +01:00
pagewalk.c
percpu-internal.h
percpu-km.c
percpu-stats.c
percpu-vm.c
percpu.c
pgalloc-track.h
pgtable-generic.c
process_vm_access.c
ptdump.c mm/ptdump: take the memory hotplug lock inside ptdump_walk_pgd() 2025-08-28 16:22:55 +02:00
readahead.c
rmap.c
rodata_test.c
shmem.c mm: update memfd seal write check to include F_SEAL_WRITE 2025-08-28 16:22:55 +02:00
shuffle.c
shuffle.h
slab_common.c
slab.c
slab.h mm: extract might_alloc() debug check 2025-08-28 16:22:37 +02:00
slob.c mm: extract might_alloc() debug check 2025-08-28 16:22:37 +02:00
slub.c mm/slub: avoid accessing metadata when pointer is invalid in object_err() 2025-09-09 18:45:22 +02:00
sparse-vmemmap.c
sparse.c
swap_cgroup.c
swap_slots.c
swap_state.c
swap.c
swapfile.c
truncate.c
usercopy.c
userfaultfd.c
util.c mm: unconditionally close VMAs on error 2024-12-14 19:47:40 +01:00
vmacache.c
vmalloc.c mm/vmalloc: leave lazy MMU mode on PTE mapping error 2025-08-28 16:22:29 +02:00
vmpressure.c
vmscan.c mm: add missing release barrier on PGDAT_RECLAIM_LOCKED unlock 2025-05-02 07:40:56 +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:22:53 +02:00
zswap.c