[GIT PULL] slab updates for 6.11

Vlastimil Babka
2024-09-16T09:45:48Z

Hi Linus,

please pull the latest slab updates from:

git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab.git tags/slab-for-6.12

There's a small conflict with the rcu tree:
https://lore.kernel.org/lkml/20240812124748.3725011b@canb.auug.org.au/

For Christian's kmem_cache_create refactoring series, a commit in the vfs.file
tree was merged as a prerequisity, and you have already merged vfs.file. Due to
vfs.tree based on 6.11-rc4 and slab on v6.11-rc5, the git pull-rq generated
diffstat below now however seems to contain also changes from rc5 commits. The
shortlog is accurate.

Thanks,
Vlastimil

======================================

This time it's mostly refactoring and improving APIs for slab users in the
kernel, along with some debugging improvements.

* kmem_cache_create() refactoring (Christian Brauner)

Over the years have been growing new parameters to kmem_cache_create() where
most of them are needed only for a small number of caches - most recently the
rcu_freeptr_offset parameter. To avoid adding new parameters to
kmem_cache_create() and adjusting all its callers, or creating new wrappers
such as kmem_cache_create_rcu(), we can now pass extra parameters using the
new struct kmem_cache_args. Not explicitly initialized fields default to values
interpreted as unused. kmem_cache_create() is for now a wrapper that works both
with the new form: kmem_cache_create(name, object_size, args, flags) and the
legacy form: kmem_cache_create(name, object_size, align, flags, ctor)

* kmem_cache_destroy() waits for kfree_rcu()'s in flight (Vlastimil Babka,
Uladislau Rezki)

Since SLOB removal, kfree() is allowed for freeing objects allocated by
kmem_cache_create(). By extension kfree_rcu() as allowed as well, which can
allow converting simple call_rcu() callbacks that only do kmem_cache_free(),
as there was never a kmem_cache_free_rcu() variant. However, for caches that
can be destroyed e.g. on module removal, the cache owners knew to issue
rcu_barrier() first to wait for the pending call_rcu()'s, and this is not
sufficient for pending kfree_rcu()'s due to its internal batching
optimizations. Ulad has provided a new kvfree_rcu_barrier() and to make the
usage less error-prone, kmem_cache_destroy() calls it. Additionally, destroying
SLAB_TYPESAFE_BY_RCU caches now again issues rcu_barrier() synchronously
instead of using an async work, because the past motivation for async work no
longer applies. Users of custom call_rcu() callbacks should however keep
calling rcu_barrier() before cache destruction.

* Debugging use-after-free in SLAB_TYPESAFE_BY_RCU caches (Jann Horn)

Currently, KASAN cannot catch UAFs in such caches as it is legal to access
them within a grace period, and we only track the grace period when trying to
free the underlying slab page. The new CONFIG_SLUB_RCU_DEBUG option changes the
freeing of individual object to be RCU-delayed, after which KASAN can poison
them.

* Delayed memcg charging (Shakeel Butt)

In some cases, the memcg is uknown at allocation time, such as receiving network
packets in softirq context. With kmem_cache_charge() these may be now charged
later when the user and its memcg is known.

* Misc fixes and improvements (Pedro Falcato, Axel Rasmussen, Christoph Lameter,
Yan Zhen, Peng Fan, Xavier).

----------------------------------------------------------------
Axel Rasmussen (1):
mm, slub: print CPU id (and its node) on slab OOM

Christian Brauner (17):
slab: s/__kmem_cache_create/do_kmem_cache_create/g
slab: add struct kmem_cache_args
slab: port kmem_cache_create() to struct kmem_cache_args
slab: port kmem_cache_create_rcu() to struct kmem_cache_args
slab: port kmem_cache_create_usercopy() to struct kmem_cache_args
slab: pass struct kmem_cache_args to create_cache()
slab: pull kmem_cache_open() into do_kmem_cache_create()
slab: pass struct kmem_cache_args to do_kmem_cache_create()
slab: remove rcu_freeptr_offset from struct kmem_cache
slab: port KMEM_CACHE() to struct kmem_cache_args
slab: port KMEM_CACHE_USERCOPY() to struct kmem_cache_args
slab: create kmem_cache_create() compatibility layer
file: port to struct kmem_cache_args
slab: remove kmem_cache_create_rcu()
slab: make kmem_cache_create_usercopy() static inline
slab: make __kmem_cache_create() static inline
io_uring: port to struct kmem_cache_args

Christoph Lameter (1):
Reenable NUMA policy support in the slab allocator

Jann Horn (2):
kasan: catch invalid free before SLUB reinitializes the object
slub: Introduce CONFIG_SLUB_RCU_DEBUG

Pedro Falcato (1):
slab: Warn on duplicate cache names when DEBUG_VM=y

Peng Fan (1):
mm, slub: avoid zeroing kmalloc redzone

Shakeel Butt (1):
memcg: add charging of already allocated slab objects

Uladzislau Rezki (Sony) (1):
rcu/kvfree: Add kvfree_rcu_barrier() API

Vlastimil Babka (10):
mm, slab: dissolve shutdown_cache() into its caller
mm, slab: unlink slabinfo, sysfs and debugfs immediately
mm, slab: move kfence_shutdown_cache() outside slab_mutex
mm, slab: reintroduce rcu_barrier() into kmem_cache_destroy()
mm, slab: call kvfree_rcu_barrier() from kmem_cache_destroy()
kunit, slub: add test_kfree_rcu() and test_leak_destroy()
Merge branch 'vfs.file' of gitolite.kernel.org:pub/scm/linux/kernel/git/vfs/vfs into slab/for-6.12/kmem_cache_args
mm, slab: restore kerneldoc for kmem_cache_create()
Merge branch 'slab/for-6.12/rcu_barriers' into slab/for-next
Merge branch 'slab/for-6.12/kmem_cache_args' into slab/for-next

Xavier (1):
mm/slab: Optimize the code logic in find_mergeable()

Yan Zhen (1):
mm, slab: use kmem_cache_free() to free from kmem_buckets_cache

Documentation/core-api/workqueue.rst | 2 +-
.../bindings/input/touchscreen/edt-ft5x06.yaml | 1 +
Documentation/filesystems/erofs.rst | 2 +-
Documentation/filesystems/smb/ksmbd.rst | 26 +-
Documentation/kbuild/llvm.rst | 2 +-
MAINTAINERS | 36 +-
Makefile | 4 +-
arch/arm64/kvm/mmu.c | 9 +-
arch/arm64/kvm/sys_regs.c | 6 +
arch/arm64/kvm/vgic/vgic-debug.c | 2 +-
arch/arm64/kvm/vgic/vgic-init.c | 9 +-
arch/arm64/kvm/vgic/vgic.c | 5 +
arch/arm64/kvm/vgic/vgic.h | 7 +
arch/mips/kernel/cevt-r4k.c | 15 +-
arch/mips/kernel/cpu-probe.c | 4 +
arch/s390/Kconfig | 13 +
arch/s390/boot/startup.c | 58 +--
arch/s390/boot/vmem.c | 14 +-
arch/s390/boot/vmlinux.lds.S | 7 +-
arch/s390/include/asm/page.h | 3 +-
arch/s390/kernel/setup.c | 19 +-
arch/s390/kernel/vmlinux.lds.S | 2 +-
arch/s390/tools/relocs.c | 2 +-
block/blk-lib.c | 25 +-
drivers/accessibility/speakup/genmap.c | 1 -
drivers/accessibility/speakup/makemapdata.c | 1 -
drivers/acpi/video_detect.c | 22 ++
drivers/ata/pata_macio.c | 30 +-
drivers/bluetooth/btintel.c | 10 -
drivers/bluetooth/btintel_pcie.c | 3 -
drivers/bluetooth/btmtksdio.c | 3 -
drivers/bluetooth/btrtl.c | 1 -
drivers/bluetooth/btusb.c | 4 +-
drivers/bluetooth/hci_qca.c | 4 +-
drivers/bluetooth/hci_vhci.c | 2 -
drivers/cxl/core/pci.c | 10 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_psp_ta.c | 3 +
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c | 5 +-
drivers/gpu/drm/amd/amdgpu/sdma_v5_2.c | 18 +-
drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 4 +-
drivers/gpu/drm/msm/adreno/adreno_gpu.c | 2 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 4 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 4 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 14 +-
drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 20 +-
drivers/gpu/drm/msm/dp/dp_ctrl.c | 2 +
drivers/gpu/drm/msm/dp/dp_panel.c | 19 +-
drivers/gpu/drm/msm/msm_mdss.c | 2 +-
drivers/gpu/drm/nouveau/nvkm/core/firmware.c | 9 +-
drivers/gpu/drm/nouveau/nvkm/falcon/fw.c | 6 +
drivers/gpu/drm/xe/Makefile | 2 +
drivers/gpu/drm/xe/display/xe_display.c | 28 +-
drivers/gpu/drm/xe/display/xe_dsb_buffer.c | 8 +
drivers/gpu/drm/xe/display/xe_fb_pin.c | 3 +
drivers/gpu/drm/xe/regs/xe_gt_regs.h | 9 +
drivers/gpu/drm/xe/xe_bo.c | 6 +-
drivers/gpu/drm/xe/xe_device.c | 32 ++
drivers/gpu/drm/xe/xe_device.h | 1 +
drivers/gpu/drm/xe/xe_exec_queue.c | 24 +-
drivers/gpu/drm/xe/xe_exec_queue_types.h | 2 -
drivers/gpu/drm/xe/xe_gsc.c | 8 +-
drivers/gpu/drm/xe/xe_gt.c | 55 +++
drivers/gpu/drm/xe/xe_gt_pagefault.c | 18 +-
drivers/gpu/drm/xe/xe_gt_types.h | 6 +
drivers/gpu/drm/xe/xe_guc_submit.c | 4 +-
drivers/gpu/drm/xe/xe_hw_fence.c | 9 +-
drivers/gpu/drm/xe/xe_hw_fence_types.h | 7 +-
drivers/gpu/drm/xe/xe_mmio.c | 28 +-
drivers/gpu/drm/xe/xe_observation.c | 1 -
drivers/gpu/drm/xe/xe_pat.c | 11 +-
drivers/gpu/drm/xe/xe_pm.c | 11 +-
drivers/gpu/drm/xe/xe_preempt_fence.c | 3 +-
drivers/gpu/drm/xe/xe_preempt_fence_types.h | 2 +
drivers/gpu/drm/xe/xe_sched_job.c | 3 +-
drivers/gpu/drm/xe/xe_trace.h | 2 +-
drivers/gpu/drm/xe/xe_wa.c | 18 +
drivers/gpu/drm/xe/xe_wa_oob.rules | 1 +
drivers/hid/amd-sfh-hid/amd_sfh_hid.c | 4 +-
drivers/hid/hid-asus.c | 3 +
drivers/hid/hid-cougar.c | 2 +-
drivers/hid/hid-ids.h | 3 +
drivers/hid/hid-multitouch.c | 33 ++
drivers/hid/wacom_wac.c | 4 +-
drivers/input/joystick/adc-joystick.c | 7 +-
drivers/input/misc/uinput.c | 14 +
drivers/input/mouse/synaptics.c | 1 +
drivers/input/serio/i8042-acpipnpio.h | 29 +-
drivers/input/serio/i8042.c | 10 +-
drivers/input/touchscreen/ads7846.c | 2 +-
drivers/input/touchscreen/edt-ft5x06.c | 6 +
drivers/input/touchscreen/himax_hx83112b.c | 14 +-
drivers/iommu/iommufd/device.c | 2 +-
drivers/iommu/iommufd/selftest.c | 2 +-
drivers/mmc/core/mmc_test.c | 9 +-
drivers/mmc/host/dw_mmc.c | 8 +
drivers/mmc/host/mtk-sd.c | 8 +-
drivers/net/bonding/bond_main.c | 21 +-
drivers/net/bonding/bond_options.c | 2 +-
drivers/net/dsa/microchip/ksz_ptp.c | 5 +-
drivers/net/dsa/mv88e6xxx/global1_atu.c | 3 +-
drivers/net/dsa/ocelot/felix.c | 126 +++++-
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 +-
drivers/net/ethernet/broadcom/bnxt/bnxt.h | 2 -
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 4 -
drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 5 -
drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c | 3 +-
.../net/ethernet/freescale/dpaa2/dpaa2-switch.c | 7 +-
.../net/ethernet/intel/ice/devlink/devlink_port.c | 4 +-
drivers/net/ethernet/intel/ice/ice_base.c | 21 +-
drivers/net/ethernet/intel/ice/ice_txrx.c | 47 +--
drivers/net/ethernet/intel/igb/igb_main.c | 1 +
.../net/ethernet/marvell/octeontx2/af/rvu_cpt.c | 23 +-
drivers/net/ethernet/mellanox/mlx5/core/en.h | 1 +
drivers/net/ethernet/mellanox/mlx5/core/en_main.c | 21 +-
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 26 +-
.../mellanox/mlx5/core/lib/ipsec_fs_roce.c | 6 +-
drivers/net/ethernet/mscc/ocelot.c | 279 ++++++++++++-
drivers/net/ethernet/mscc/ocelot_fdma.c | 3 +-
drivers/net/ethernet/mscc/ocelot_vcap.c | 1 +
drivers/net/ethernet/mscc/ocelot_vsc7514.c | 4 +
drivers/net/ethernet/wangxun/ngbe/ngbe_mdio.c | 8 +-
drivers/net/ethernet/xilinx/xilinx_axienet.h | 1 +
drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 25 +-
drivers/net/phy/realtek.c | 3 +-
drivers/net/virtio_net.c | 2 +-
drivers/nvme/host/core.c | 2 +-
drivers/nvme/host/nvme.h | 1 -
drivers/platform/surface/aggregator/controller.c | 3 +-
.../platform/surface/surface_aggregator_registry.c | 58 ++-
drivers/platform/x86/asus-wmi.c | 16 +-
drivers/platform/x86/dell/Kconfig | 1 +
drivers/platform/x86/dell/dell-uart-backlight.c | 8 +
.../x86/intel/speed_select_if/isst_tpmi_core.c | 3 +-
drivers/pmdomain/imx/imx93-pd.c | 5 +-
drivers/pmdomain/imx/scu-pd.c | 5 -
drivers/power/sequencing/pwrseq-qcom-wcn.c | 2 +-
drivers/s390/crypto/ap_bus.c | 7 +-
drivers/scsi/sd.c | 3 +
drivers/spi/spi-cadence-quadspi.c | 14 +-
drivers/spi/spi-fsl-lpspi.c | 31 +-
drivers/spi/spi-pxa2xx-pci.c | 15 +-
drivers/spi/spi-pxa2xx-platform.c | 26 +-
drivers/spi/spi-pxa2xx.c | 20 +-
drivers/spi/spi-pxa2xx.h | 3 +-
drivers/spi/spi-zynqmp-gqspi.c | 30 +-
.../staging/media/atomisp/include/linux/atomisp.h | 1 -
drivers/thermal/thermal_debugfs.c | 6 +-
drivers/thermal/thermal_of.c | 23 +-
drivers/ufs/core/ufshcd.c | 6 +-
drivers/ufs/host/ufs-qcom.c | 6 +-
fs/bcachefs/alloc_background.c | 66 ++--
fs/bcachefs/alloc_background_format.h | 1 +
fs/bcachefs/bcachefs_format.h | 3 +-
fs/bcachefs/btree_cache.c | 25 ++
fs/bcachefs/btree_cache.h | 2 +
fs/bcachefs/btree_iter.h | 9 +
fs/bcachefs/btree_key_cache.c | 31 +-
fs/bcachefs/btree_update_interior.c | 46 ++-
fs/bcachefs/buckets.c | 74 ++--
fs/bcachefs/buckets_waiting_for_journal.c | 4 +-
fs/bcachefs/data_update.c | 209 +++++-----
fs/bcachefs/extents.c | 41 ++
fs/bcachefs/extents.h | 1 +
fs/bcachefs/fs-io-buffered.c | 2 +-
fs/bcachefs/fs-ioctl.c | 3 +-
fs/bcachefs/fsck.c | 6 +-
fs/bcachefs/journal.c | 2 +-
fs/bcachefs/journal_sb.c | 15 +
fs/bcachefs/movinggc.c | 2 +-
fs/bcachefs/recovery.c | 9 +-
fs/bcachefs/replicas.c | 3 +-
fs/bcachefs/sb-downgrade.c | 8 +-
fs/bcachefs/util.c | 1 -
fs/bcachefs/xattr.c | 12 +-
fs/erofs/dir.c | 35 +-
fs/erofs/inode.c | 18 +-
fs/erofs/internal.h | 2 +-
fs/erofs/super.c | 26 +-
fs/erofs/zutil.c | 3 +-
fs/file_table.c | 11 +-
fs/nfs/callback_xdr.c | 6 +-
fs/nfs/delegation.c | 15 +-
fs/nfs/nfs4proc.c | 12 +-
fs/nfs/pnfs.c | 5 +-
fs/nfs/super.c | 2 +
fs/smb/client/cifsfs.c | 6 +-
fs/smb/client/cifsglob.h | 6 +-
fs/smb/client/connect.c | 3 +
fs/smb/client/file.c | 4 +-
fs/smb/client/ioctl.c | 2 +
fs/smb/client/link.c | 1 +
fs/smb/client/reparse.c | 11 +-
fs/smb/server/connection.c | 34 +-
fs/smb/server/connection.h | 3 +-
fs/smb/server/mgmt/user_session.c | 9 +
fs/smb/server/oplock.c | 2 +-
fs/smb/server/smb2pdu.c | 31 +-
fs/smb/server/smb_common.h | 4 +-
fs/super.c | 4 +-
include/acpi/video.h | 1 +
include/linux/blkdev.h | 7 +-
include/linux/dsa/ocelot.h | 47 +++
include/linux/kasan.h | 63 ++-
include/linux/panic.h | 1 +
include/linux/rcutiny.h | 5 +
include/linux/rcutree.h | 1 +
include/linux/slab.h | 228 ++++++++++-
include/net/bluetooth/hci.h | 17 +-
include/net/bluetooth/hci_core.h | 2 +-
include/net/dsa.h | 16 +-
include/net/kcm.h | 1 +
include/scsi/scsi_cmnd.h | 2 +-
include/soc/mscc/ocelot.h | 12 +-
include/soc/mscc/ocelot_vcap.h | 2 +
include/trace/events/rpcrdma.h | 36 ++
include/uapi/drm/xe_drm.h | 8 +-
include/ufs/ufshcd.h | 8 +
io_uring/io_uring.c | 14 +-
io_uring/kbuf.c | 9 +-
kernel/cgroup/cpuset.c | 38 +-
kernel/panic.c | 8 +-
kernel/printk/printk.c | 2 +-
kernel/rcu/tree.c | 109 +++++-
kernel/workqueue.c | 50 +--
lib/slub_kunit.c | 31 ++
mm/Kconfig.debug | 32 ++
mm/kasan/common.c | 62 +--
mm/kasan/kasan_test.c | 46 +++
mm/slab.h | 13 +-
mm/slab_common.c | 354 ++++++-----------
mm/slub.c | 412 +++++++++++++-------
net/bluetooth/hci_core.c | 19 +-
net/bluetooth/hci_event.c | 2 +-
net/bluetooth/mgmt.c | 4 +
net/bluetooth/smp.c | 144 +++----
net/core/netpoll.c | 2 -
net/dsa/tag.c | 5 +-
net/dsa/tag.h | 135 +++++--
net/dsa/tag_ocelot.c | 37 +-
net/ipv4/inet_connection_sock.c | 5 +-
net/ipv4/tcp_ipv4.c | 14 +
net/ipv4/udp_offload.c | 3 +-
net/ipv6/ip6_output.c | 10 +
net/ipv6/ip6_tunnel.c | 12 +-
net/iucv/iucv.c | 4 +-
net/kcm/kcmsock.c | 4 +
net/mctp/test/route-test.c | 2 +-
net/mptcp/pm.c | 13 -
net/mptcp/pm_netlink.c | 142 ++++---
net/mptcp/protocol.h | 3 -
net/netfilter/nf_flow_table_inet.c | 3 +
net/netfilter/nf_flow_table_ip.c | 3 +
net/netfilter/nft_counter.c | 9 +-
net/openvswitch/datapath.c | 2 +-
net/sched/sch_netem.c | 47 ++-
net/sunrpc/xprtrdma/ib_client.c | 6 +-
samples/trace_events/trace_custom_sched.c | 1 -
scripts/Makefile.build | 2 +-
scripts/Makefile.lib | 28 +-
scripts/Makefile.modfinal | 2 +-
scripts/Makefile.vmlinux | 2 +-
scripts/Makefile.vmlinux_o | 2 +-
scripts/kconfig/merge_config.sh | 2 +
scripts/link-vmlinux.sh | 3 +-
sound/soc/codecs/cs42l42.c | 1 -
tools/testing/cxl/Kbuild | 1 +
tools/testing/cxl/test/mock.c | 12 +
.../selftests/drivers/net/mlxsw/ethtool_lanes.sh | 3 +-
.../selftests/net/forwarding/bridge_vlan_aware.sh | 54 ++-
tools/testing/selftests/net/forwarding/lib.sh | 57 +++
.../selftests/net/forwarding/local_termination.sh | 431 +++++++++++++++++----
tools/testing/selftests/net/mptcp/mptcp_join.sh | 76 +++-
tools/testing/selftests/net/udpgro.sh | 53 +--
tools/testing/selftests/tc-testing/tdc.py | 1 -
275 files changed, 4049 insertions(+), 1673 deletions(-)