Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp125429pxf; Wed, 24 Mar 2021 00:32:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwV1/cxdy4xR32Y+mJ166XPkYjnx2RmxPuOZaRAhEp6hMZeN4+WIVPFY7NlBq0xknwDct18 X-Received: by 2002:a05:6402:4386:: with SMTP id o6mr2005390edc.307.1616571136429; Wed, 24 Mar 2021 00:32:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616571136; cv=none; d=google.com; s=arc-20160816; b=LL5jWjickNkDeZ25HodGWACuQ49jyDBOn1cIhdBLekvz3CR8SqXC8Igx1WWHQ4gHU8 g5oZEzme85G5BVzswI+6S2GSvJbKq/hWIbtxMbIdwiPj283fRWCiUCdyJFwQfsWCmfrJ rCDt7tVCFDmcU7Fkrt5l7c5dncyuaxQyRhhq4BXNo86JUCCih343wgDKi7tedm6fT9Cy tpH9qM85xm2iryOxV3afz/t65MIl6YMCjASDBF1sZDs3Ry+Jyr4M6prhKoapVGe7u4Ni HVgOjUf0e8ak218NeHyolwwHMNgbLGPZKLeJ/uLNdS809/i9sdX4UvIAPsyMNtoVwd0S OpLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=oE8Re7U2eiRTAh9p3PAj7D06IDZ16XlxhTmOYb89s/8=; b=Uo70Rvkoaz7KbWl9HS4Kmy8gC6On9Sv92ElKIUKFPEqwh+WpmjbWkVq1N9qTsE70zN pvZMMYZhIqts3OIKu+he/BQUNhk/24tbaqa2WCIXxJJL07eteGoCzoIAK9YCaVnG7QV3 tCeB/RNgg3Kq1zLTAu9IN0xCNgcFxgsK2VIdNZiqCsJNZYyYhGTTBpmqzYXu+cp4/1wg LdiIpAV546p0+nJj2f+d8Xaeln3LTJNnA5WdLRHfYnjSbqp2hxuyt3//smVgDcy36Dsi bOnxlg45iNkqmVHIq0GaTS4y7/p9xAt2AY/odCHb9Ocyopq3V9zh+PQIHalCx/sTgpjS SBPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=FJMeWXH+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t23si1069702ejj.290.2021.03.24.00.31.53; Wed, 24 Mar 2021 00:32:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=FJMeWXH+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233498AbhCWV2x (ORCPT + 99 others); Tue, 23 Mar 2021 17:28:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233533AbhCWV21 (ORCPT ); Tue, 23 Mar 2021 17:28:27 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B8C8C0613D8 for ; Tue, 23 Mar 2021 14:28:27 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id g8so21674222lfv.12 for ; Tue, 23 Mar 2021 14:28:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=oE8Re7U2eiRTAh9p3PAj7D06IDZ16XlxhTmOYb89s/8=; b=FJMeWXH+SaUw1EE94VwNSxeUROOX72sUs1KyGDlEqEifmVqm6Nm3+EZZBosnRVkNGA DwxLHCyqmfawP6Noi2RmaV7umcSzUA11e/grp81xPwUhI1/iUNw/31OWqPVezUi91wPY utRanRrza0bGC2bDni7GFzhhO8qr0A+tJ0WoLmYS03HJlVuW9rKonI4L+EpSvQFYjHz9 bx+e6/Rti7mbXHAHS4ixI/leP99NIwuDcxTcvOG3aXffNhVOM7g7cM+FEvnwPm4H6KYn FURJXnuQWRaVS4qInf/SKXxXGqlhptU8V21fgmbumrv01osdiuNJB+olA1xskDVq/+2Q LP1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=oE8Re7U2eiRTAh9p3PAj7D06IDZ16XlxhTmOYb89s/8=; b=gA/eeMabGpdv7JfHfXn51FuJkggQC3NDy4AJae541AyG/o5CS3TTe35FE79SWGAZQq h89qa53tD3qtXJpKPWpIM3rJhlAKzB5KF+V4ObsLVdenm8g3JQevVL2a+yAyYMI4o7Xi YtJyICtJluwRxjAavn7yzr60v8GxNIvEeZtC32sSHXLokV5KetfxDZgdU/j5RYe+MV8I Xu5J29Gso7HntfOuy2bNxFnYDDjgkH008L7/P925nUmF7vbQ69s7qN10xzRlv+ChLEhl nWbsH3YW790AbrGl9LaqzMqp0J3ui0XGZ7paLeuC+tJoyeta7TfNEQDq9fitQM/4HdjR OVAg== X-Gm-Message-State: AOAM531AHcvTBT4B8qluZNrBfNoh9PjwNotJCL4ndOy0hZkHtUXOwMes dJLjQnoGiFNjBPIlwJo5FpSG4EoYB8L73UA+RuyxgA== X-Received: by 2002:a19:8c19:: with SMTP id o25mr1333lfd.547.1616534904876; Tue, 23 Mar 2021 14:28:24 -0700 (PDT) MIME-Version: 1.0 References: <20210323203946.2159693-1-samitolvanen@google.com> <20210323203946.2159693-10-samitolvanen@google.com> In-Reply-To: <20210323203946.2159693-10-samitolvanen@google.com> From: Nick Desaulniers Date: Tue, 23 Mar 2021 14:28:13 -0700 Message-ID: Subject: Re: [PATCH v3 09/17] treewide: Change list_sort to use const pointers To: Sami Tolvanen Cc: Kees Cook , Nathan Chancellor , Masahiro Yamada , Will Deacon , Jessica Yu , Arnd Bergmann , Tejun Heo , "Paul E. McKenney" , Christoph Hellwig , Peter Zijlstra , bpf , linux-hardening@vger.kernel.org, linux-arch , Linux ARM , Linux Kbuild mailing list , PCI , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 23, 2021 at 1:40 PM Sami Tolvanen 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 > Signed-off-by: Sami Tolvanen > --- > 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 Tested-by: Nick Desaulniers -- Thanks, ~Nick Desaulniers