]> git.ipfire.org Git - thirdparty/linux.git/commit - net/tipc/name_table.c
treewide: Change list_sort to use const pointers
authorSami Tolvanen <samitolvanen@google.com>
Thu, 8 Apr 2021 18:28:34 +0000 (11:28 -0700)
committerKees Cook <keescook@chromium.org>
Thu, 8 Apr 2021 23:04:22 +0000 (16:04 -0700)
commit4f0f586bf0c898233d8f316f471a21db2abd522d
tree3b3ec78051f5a5d2b96f834347355b1b306026ea
parent9f5b4009980f369acb80b72235b2d66c3fd6eca6
treewide: Change list_sort to use const pointers

list_sort() internally casts the comparison function passed to it
to a different type with constant struct list_head pointers, and
uses this pointer to call the functions, which trips indirect call
Control-Flow Integrity (CFI) checking.

Instead of removing the consts, this change defines the
list_cmp_func_t type and changes the comparison function types of
all list_sort() callers to use const pointers, thus avoiding type
mismatches.

Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Kees Cook <keescook@chromium.org>
Tested-by: Nick Desaulniers <ndesaulniers@google.com>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20210408182843.1754385-10-samitolvanen@google.com
41 files changed:
arch/arm64/kvm/vgic/vgic-its.c
arch/arm64/kvm/vgic/vgic.c
block/blk-mq-sched.c
block/blk-mq.c
drivers/acpi/nfit/core.c
drivers/acpi/numa/hmat.c
drivers/clk/keystone/sci-clk.c
drivers/gpu/drm/drm_modes.c
drivers/gpu/drm/i915/gt/intel_engine_user.c
drivers/gpu/drm/i915/gvt/debugfs.c
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
drivers/gpu/drm/radeon/radeon_cs.c
drivers/infiniband/hw/usnic/usnic_uiom_interval_tree.c
drivers/interconnect/qcom/bcm-voter.c
drivers/md/raid5.c
drivers/misc/sram.c
drivers/nvme/host/core.c
drivers/pci/controller/cadence/pcie-cadence-host.c
drivers/spi/spi-loopback-test.c
fs/btrfs/raid56.c
fs/btrfs/tree-log.c
fs/btrfs/volumes.c
fs/ext4/fsmap.c
fs/gfs2/glock.c
fs/gfs2/log.c
fs/gfs2/lops.c
fs/iomap/buffered-io.c
fs/ubifs/gc.c
fs/ubifs/replay.c
fs/xfs/scrub/bitmap.c
fs/xfs/xfs_bmap_item.c
fs/xfs/xfs_buf.c
fs/xfs/xfs_extent_busy.c
fs/xfs/xfs_extent_busy.h
fs/xfs/xfs_extfree_item.c
fs/xfs/xfs_refcount_item.c
fs/xfs/xfs_rmap_item.c
include/linux/list_sort.h
lib/list_sort.c
lib/test_list_sort.c
net/tipc/name_table.c