Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1010453pxf; Thu, 25 Mar 2021 21:39:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVhslEZ7qRHhrmHtvMsVwRHPjRONJyWRX+OqsyCIP/wZ9T5zPQu2HQD49vRYiNIFChkrQO X-Received: by 2002:a50:fc94:: with SMTP id f20mr12840877edq.370.1616733548665; Thu, 25 Mar 2021 21:39:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616733548; cv=none; d=google.com; s=arc-20160816; b=jkW32fj2Yo5bfgpMiuvGuf7tlvBp5QPDQzet4ssOUHprqIHfdlMbFuHjWGL/HbSdUh 2WE/428BWsMqfQZGgC/YyUL9sT/jg8oKum1SYfsCcFjUNzIEO1+/KU43+CA2Sk4/PjYU jn1hWsB2s2Yzf8eP+ySBA7QkYU7JHEgIPEaNgk0IpuugXDP9VJFvs1xkTXUBehRJrCWY Vu+s5AgmZx5e93c7n+dkCh0gztiOyJV1jXL3jfMVIRgFXRI8DoDdlSjaTUlM8eISbeSm xSi6tclXZ1SN6RsBP9AWgJBo7NTSjMP3YjD61LERLPFBY7l9A45RKPehCfJm8hy98Tdu nHwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=vxhJYqYDEMLCG7mk2hvbmEzicWN7eS/ImmMoA4Wpy9s=; b=RnGQtRjAaTrsNUWRLir+BUELoppBeyZLixyoJBX5XM6EOKu1LzsjxA6fGK7wrSHH8Y sJkphq1XxAT5rb+Exow+ggJTRouNtTwryAdMHj3ifF5jmwbi6DRkVKssUaJ1feJrXj9n MO9OohizJqS5+o1/IUWV1LYBO8jzB9s+HGRRzOKgUALO0vYpk+49dZpW050FxFHWgg58 db7Gc0EEvlUw15FDbJik06MT/l0UTf18EADmyBrZgOj/2KQ9/BHfJPaWIRNt81pHqBnB gvxgxDM1OtJlPpadQ9aS9ghgZO1D9IuRphzevOHZypDSIVUhLTzEYZX/Fe/LywIqRG4J ybEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Y7C2yx9t; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 24si6692419edv.533.2021.03.25.21.38.46; Thu, 25 Mar 2021 21:39:08 -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=@chromium.org header.s=google header.b=Y7C2yx9t; 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=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231421AbhCZEfn (ORCPT + 99 others); Fri, 26 Mar 2021 00:35:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231470AbhCZEf0 (ORCPT ); Fri, 26 Mar 2021 00:35:26 -0400 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 27ECFC0613DE for ; Thu, 25 Mar 2021 21:35:26 -0700 (PDT) Received: by mail-pj1-x1032.google.com with SMTP id gb6so2003195pjb.0 for ; Thu, 25 Mar 2021 21:35:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=vxhJYqYDEMLCG7mk2hvbmEzicWN7eS/ImmMoA4Wpy9s=; b=Y7C2yx9t4jVJNzzq+bJUag8zcjHDw7vTM3dhGvCOhTUSNJ9rVJAGUyw/R1kV1BKF9h UBZcJlu9jC+zABe5EH5uKqrAMx5g2Si4eSS06uLrUMls5fsYouIWM1mvmNY3BhP1kCgI 7z3GGiGVF/ZfEa0cIMn6Cl6WedLtccFzIZQLc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=vxhJYqYDEMLCG7mk2hvbmEzicWN7eS/ImmMoA4Wpy9s=; b=sXCW1TCwyx1XwOxUmVG++Gz9xOrBlWCW4HIkQnsZ4yvcEwv+s4jc+hMvUCC3y199ci hwXAdV0taWPQc6rdTtU4PKdzUiIPcwOzdSaHvFl4jyTDpmJESEbOPHmaJAE9LGvJbT68 RDt9hFVH/ahZDTE/a3dQwDqaxi40An3F/q8JsQWl3rsFG9iBcrKNfib3TIPhxTjp58cj m9sxxOYgs9T8L+kZ8WNSY+9c/KMsqb8OGkTfZz/9r353g1Y5e+fws6Aw0qMpsYWys2Rt DFBE1b5OCgRHl65kxDqzIFqCA4Qn1p2vuwkZGREoSlHpk0bfzz4zvVRkoBTevqjbSxsi 76qA== X-Gm-Message-State: AOAM531kPJmr1/FIs0yTEvK75wG6IGlzvaKAarHIGYM9ZkZYRmCToMZA xAZbnwPyAM2jhAcMJa5UUOjEMQ== X-Received: by 2002:a17:902:d4cb:b029:e5:f608:6d5e with SMTP id o11-20020a170902d4cbb02900e5f6086d5emr13342060plg.20.1616733325756; Thu, 25 Mar 2021 21:35:25 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id u84sm7686856pfc.90.2021.03.25.21.35.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Mar 2021 21:35:25 -0700 (PDT) Date: Thu, 25 Mar 2021 21:35:24 -0700 From: Kees Cook To: Sami Tolvanen Cc: Nathan Chancellor , Nick Desaulniers , Masahiro Yamada , Will Deacon , Jessica Yu , Arnd Bergmann , Tejun Heo , "Paul E. McKenney" , Christoph Hellwig , Peter Zijlstra , bpf@vger.kernel.org, linux-hardening@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kbuild@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 09/17] treewide: Change list_sort to use const pointers Message-ID: <202103252135.9B17EFB@keescook> References: <20210323203946.2159693-1-samitolvanen@google.com> <20210323203946.2159693-10-samitolvanen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210323203946.2159693-10-samitolvanen@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 23, 2021 at 01:39:38PM -0700, 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 Reviewed-by: Kees Cook -- Kees Cook