lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 23 Mar 2021 14:28:13 -0700
From:   Nick Desaulniers <ndesaulniers@...gle.com>
To:     Sami Tolvanen <samitolvanen@...gle.com>
Cc:     Kees Cook <keescook@...omium.org>,
        Nathan Chancellor <nathan@...nel.org>,
        Masahiro Yamada <masahiroy@...nel.org>,
        Will Deacon <will@...nel.org>, Jessica Yu <jeyu@...nel.org>,
        Arnd Bergmann <arnd@...db.de>, Tejun Heo <tj@...nel.org>,
        "Paul E. McKenney" <paulmck@...nel.org>,
        Christoph Hellwig <hch@...radead.org>,
        Peter Zijlstra <peterz@...radead.org>,
        bpf <bpf@...r.kernel.org>, linux-hardening@...r.kernel.org,
        linux-arch <linux-arch@...r.kernel.org>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
        PCI <linux-pci@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 09/17] treewide: Change list_sort to use const pointers

On Tue, Mar 23, 2021 at 1:40 PM Sami Tolvanen <samitolvanen@...gle.com> 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@...gle.com>
> Signed-off-by: Sami Tolvanen <samitolvanen@...gle.com>
> ---
>  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@...gle.com>
Tested-by: Nick Desaulniers <ndesaulniers@...gle.com>
-- 
Thanks,
~Nick Desaulniers

Powered by blists - more mailing lists