Re: [PATCH v3 09/17] treewide: Change list_sort to use const pointers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 23, 2021 at 1:40 PM Sami Tolvanen <samitolvanen@xxxxxxxxxx> wrote:
>
> 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@xxxxxxxxxx>
> Signed-off-by: Sami Tolvanen <samitolvanen@xxxxxxxxxx>
> ---
>  arch/arm64/kvm/vgic/vgic-its.c                  |  8 ++++----
>  arch/arm64/kvm/vgic/vgic.c                      |  3 ++-
>  block/blk-mq-sched.c                            |  3 ++-
>  block/blk-mq.c                                  |  3 ++-
>  drivers/acpi/nfit/core.c                        |  3 ++-
>  drivers/acpi/numa/hmat.c                        |  3 ++-
>  drivers/clk/keystone/sci-clk.c                  |  4 ++--
>  drivers/gpu/drm/drm_modes.c                     |  3 ++-
>  drivers/gpu/drm/i915/gt/intel_engine_user.c     |  3 ++-
>  drivers/gpu/drm/i915/gvt/debugfs.c              |  2 +-
>  drivers/gpu/drm/i915/selftests/i915_gem_gtt.c   |  3 ++-
>  drivers/gpu/drm/radeon/radeon_cs.c              |  4 ++--
>  .../hw/usnic/usnic_uiom_interval_tree.c         |  3 ++-
>  drivers/interconnect/qcom/bcm-voter.c           |  2 +-
>  drivers/md/raid5.c                              |  3 ++-
>  drivers/misc/sram.c                             |  4 ++--
>  drivers/nvme/host/core.c                        |  3 ++-
>  .../pci/controller/cadence/pcie-cadence-host.c  |  3 ++-
>  drivers/spi/spi-loopback-test.c                 |  3 ++-
>  fs/btrfs/raid56.c                               |  3 ++-
>  fs/btrfs/tree-log.c                             |  3 ++-
>  fs/btrfs/volumes.c                              |  3 ++-
>  fs/ext4/fsmap.c                                 |  4 ++--
>  fs/gfs2/glock.c                                 |  3 ++-
>  fs/gfs2/log.c                                   |  2 +-
>  fs/gfs2/lops.c                                  |  3 ++-
>  fs/iomap/buffered-io.c                          |  3 ++-
>  fs/ubifs/gc.c                                   |  7 ++++---
>  fs/ubifs/replay.c                               |  4 ++--
>  fs/xfs/scrub/bitmap.c                           |  4 ++--
>  fs/xfs/xfs_bmap_item.c                          |  4 ++--
>  fs/xfs/xfs_buf.c                                |  6 +++---
>  fs/xfs/xfs_extent_busy.c                        |  4 ++--
>  fs/xfs/xfs_extent_busy.h                        |  3 ++-
>  fs/xfs/xfs_extfree_item.c                       |  4 ++--
>  fs/xfs/xfs_refcount_item.c                      |  4 ++--
>  fs/xfs/xfs_rmap_item.c                          |  4 ++--
>  include/linux/list_sort.h                       |  7 ++++---
>  lib/list_sort.c                                 | 17 ++++++-----------
>  lib/test_list_sort.c                            |  3 ++-
>  net/tipc/name_table.c                           |  4 ++--
>  41 files changed, 90 insertions(+), 72 deletions(-)

This looks like all of the call sites I could find.  Yes, this looks
much better, thank you for taking the time to fix all of these. I ran
this through some build tests of ARCH=arm64 defconfig, allyesconfig,
and same for my host (x86_64). All LGTM.

Reviewed-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
Tested-by: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
-- 
Thanks,
~Nick Desaulniers



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux