linux/mm
Hao Ge 86f54f9b6c slab: reset slab->obj_ext when freeing and it is OBJEXTS_ALLOC_FAIL
If obj_exts allocation failed, slab->obj_exts is set to OBJEXTS_ALLOC_FAIL,
But we do not clear it when freeing the slab. Since OBJEXTS_ALLOC_FAIL and
MEMCG_DATA_OBJEXTS currently share the same bit position, during the
release of the associated folio, a VM_BUG_ON_FOLIO() check in
folio_memcg_kmem() is triggered because the OBJEXTS_ALLOC_FAIL flag was
not cleared, causing it to be interpreted as a kmem folio (non-slab)
with MEMCG_OBJEXTS_DATA flag set, which is invalid because
MEMCG_OBJEXTS_DATA is supposed to be set only on slabs.

Another problem that predates sharing the OBJEXTS_ALLOC_FAIL and
MEMCG_DATA_OBJEXTS bits is that on configurations with
is_check_pages_enabled(), the non-cleared bit in page->memcg_data will
trigger a free_page_is_bad() failure "page still charged to cgroup"

When freeing a slab, we clear slab->obj_exts if the obj_ext array has
been successfully allocated. So let's clear it also when the allocation
has failed.

Fixes: 09c46563ff ("codetag: debug: introduce OBJEXTS_ALLOC_FAIL to mark failed slab_ext allocations")
Fixes: 7612833192 ("slab: Reuse first bit for OBJEXTS_ALLOC_FAIL")
Link: https://lore.kernel.org/all/20251015141642.700170-1-hao.ge@linux.dev/
Cc: <stable@vger.kernel.org>
Signed-off-by: Hao Ge <gehao@kylinos.cn>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Reviewed-by: Harry Yoo <harry.yoo@oracle.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
2025-10-16 15:16:45 +02:00
..
damon mm/damon/vaddr: do not repeat pte_offset_map_lock() until success 2025-10-07 14:01:12 -07:00
kasan Summary of significant series in this pull request: 2025-10-02 18:18:33 -07:00
kfence
kmsan dma-mapping fixes for Linux 6.18: 2025-10-07 12:48:06 -07:00
Kconfig
Kconfig.debug
Makefile
backing-dev.c fuse update for 6.18 2025-10-03 12:48:18 -07:00
balloon_compaction.c
bootmem_info.c
cma.c
cma.h
cma_debug.c
cma_sysfs.c
compaction.c
debug.c
debug_page_alloc.c
debug_page_ref.c
debug_vm_pgtable.c
dmapool.c
dmapool_test.c
early_ioremap.c
execmem.c
fadvise.c
fail_page_alloc.c
failslab.c
filemap.c NFS Client Updates for Linux 6.18 2025-10-03 14:20:40 -07:00
folio-compat.c
gup.c
gup_test.c
gup_test.h
highmem.c
hmm.c dma-mapping updates for Linux 6.18: 2025-10-03 17:41:12 -07:00
huge_memory.c mm/thp: fix MTE tag mismatch when replacing zero-filled subpages 2025-10-07 14:01:11 -07:00
hugetlb.c mm: hugetlb: avoid soft lockup when mprotect to large memory area 2025-10-07 14:01:12 -07:00
hugetlb_cgroup.c
hugetlb_cma.c
hugetlb_cma.h
hugetlb_vmemmap.c
hugetlb_vmemmap.h
hwpoison-inject.c
init-mm.c
internal.h
interval_tree.c
ioremap.c
khugepaged.c mm/khugepaged: use KMEM_CACHE() 2025-10-03 16:42:44 -07:00
kmemleak.c
ksm.c mm/ksm: cleanup mm_slot_entry() invocation 2025-10-03 16:42:44 -07:00
list_lru.c
maccess.c
madvise.c mm: clean up is_guard_pte_marker() 2025-10-03 16:42:43 -07:00
mapping_dirty_helpers.c
memblock.c kho: replace kho_preserve_phys() with kho_preserve_pages() 2025-10-07 13:48:55 -07:00
memcontrol-v1.c
memcontrol-v1.h
memcontrol.c memcg: skip cgroup_file_notify if spinning is not allowed 2025-10-07 14:01:11 -07:00
memfd.c
memory-failure.c
memory-tiers.c
memory.c
memory_hotplug.c mm/memory_hotplug: activate node before adding new memory blocks 2025-10-03 16:42:43 -07:00
mempolicy.c
mempool.c
memremap.c
memtest.c
migrate.c mm/rmap: fix soft-dirty and uffd-wp bit loss when remapping zero-filled mTHP subpage to shared zeropage 2025-10-07 14:01:11 -07:00
migrate_device.c
mincore.c
mlock.c
mm_init.c mm/mm_init: simplify deferred initialization of struct pages 2025-10-04 11:03:10 -07:00
mm_slot.h
mmap.c
mmap_lock.c
mmu_gather.c
mmu_notifier.c
mmzone.c
mprotect.c
mremap.c
mseal.c
msync.c
nommu.c
numa.c
numa_emulation.c
numa_memblks.c
oom_kill.c
page-writeback.c fuse update for 6.18 2025-10-03 12:48:18 -07:00
page_alloc.c
page_counter.c
page_ext.c
page_frag_cache.c
page_idle.c
page_io.c
page_isolation.c
page_owner.c
page_poison.c
page_reporting.c
page_reporting.h
page_table_check.c
page_vma_mapped.c
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
pt_reclaim.c
ptdump.c
readahead.c
rmap.c
rodata_test.c
secretmem.c
shmem.c
shmem_quota.c
show_mem.c
shrinker.c
shrinker_debug.c
shuffle.c
shuffle.h
slab.h
slab_common.c
slub.c slab: reset slab->obj_ext when freeing and it is OBJEXTS_ALLOC_FAIL 2025-10-16 15:16:45 +02:00
sparse-vmemmap.c
sparse.c
swap.c
swap.h
swap_cgroup.c
swap_state.c
swap_table.h
swapfile.c
truncate.c
usercopy.c
userfaultfd.c
util.c fsnotify: pass correct offset to fsnotify_mmap_perm() 2025-10-07 14:01:12 -07:00
vma.c
vma.h
vma_exec.c
vma_init.c
vma_internal.h
vmalloc.c
vmpressure.c
vmscan.c
vmstat.c
workingset.c
zpdesc.h
zsmalloc.c
zswap.c