Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp47878rwe; Wed, 31 Aug 2022 16:09:16 -0700 (PDT) X-Google-Smtp-Source: AA6agR4WDrov3ZICZgahBXm4jNOytBiMl/lnKj4frQWfFZ/S+0/rxMAsb+8kObmc8NfieCdP9RSL X-Received: by 2002:a05:6402:500d:b0:440:9bc5:d0c1 with SMTP id p13-20020a056402500d00b004409bc5d0c1mr26547930eda.202.1661987356246; Wed, 31 Aug 2022 16:09:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661987356; cv=none; d=google.com; s=arc-20160816; b=LOL5ZMbN9WueUEhJZlyM4Z/U0lsqVUupOFa6leHxbwawsnhRwhPAQWVDSEEsHdwS7U zmATjA45MXj3bf+jIxkGAk6s/XW/qXX8maACFY6fzXlGNyYNnLLzF92VHRGm6s5se0un j6+xC6gHoCirU4VJVn6DnL60NluTzsNx+Y636dlBcu1MaCd7k8uB+QAFype9luMfCK40 BYMNlufzjMT5Hyvx5V0lUSZEYOr6mw4+eVkOX8o6/Z+BD7p9HUorT/6HSkLeiaU3qtTc RVRA/iih0GFe4i7uMiKhn3sW/aXrR4HaG24uSmLER1z3IbBqeKDY9kZvzadUlYYxvmKZ /0Pw== 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=eXEYaFnP4mOKjstNFujmxTiRRJjn9XYWqPXOjFo+1fQ=; b=lzz+KofanK91DsMKut/wEZWf3rF3BHrHDiko+Debi6A8majWwxVmumYkRs4+JW4TqH xbygF5g1Kdj0dDUrNGoKYHV51kjlvtCtLxQS2bcGh79rjmJpFwTz2NMAAhtbzuRblSzp mFYvzEHtflWMwxhQXhN8XRNAylqs0ygvnKTWCmo8dwz3hl+T+5gkcQn3DA948vOZC9pA 6gM6MvIeuyoCcGHR/+4m6hGRMcv+5YSTQ6kkmJ5OXmaDVnrduglXlBhW/apJjTtBQVVT uH3AU/YCmMfrDIQYT3QHyc3OG8NPIkgo0w3Haup9N/V4P31FXa+HixBIQX9N/1NprXXW oG/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="S/NcZDY5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id he9-20020a1709073d8900b0073d7515b235si12868847ejc.533.2022.08.31.16.08.50; Wed, 31 Aug 2022 16:09:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="S/NcZDY5"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S232335AbiHaWEZ (ORCPT + 99 others); Wed, 31 Aug 2022 18:04:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231308AbiHaWEY (ORCPT ); Wed, 31 Aug 2022 18:04:24 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E4A4E8301 for ; Wed, 31 Aug 2022 15:04:23 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id 202so14655167pgc.8 for ; Wed, 31 Aug 2022 15:04:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc; bh=eXEYaFnP4mOKjstNFujmxTiRRJjn9XYWqPXOjFo+1fQ=; b=S/NcZDY5SZ6CRMmy+D6KjP0bTurAvGghafOwYbc+nw/dwS4ozUP9sQwnkdU2qYD+X1 8UMSc5iO5Qk+z++YNmfVFYjUcIBjFchohVKc75j5HUMkRFDUetf4U6l4sH4tLuN2RSPS ffiBV5V5SggAAOzfGOvkiCIpVaWQVrpea4yF8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=eXEYaFnP4mOKjstNFujmxTiRRJjn9XYWqPXOjFo+1fQ=; b=1o8hBCn5bgg25gQgsV2Pg33tCB3Iu3I6jxf4hHkvct82fXBE/PCniJHqwOE4HpuKbw qOjxi14ISe0ypeg/knYRhSXG9Nwv357FZVpxAy03lg5OLMUi4ZvF9FrhVFmbRlv/yYH9 sFllRfVd5oRInILdJpM1mwDM4p2FYP3XZBAihNNJoJStM4TPWCXfQeU/iaDbMEj7j7cq 5Gnn/j8jiVmaLfpm/hAJYxc98YIfFDE+1bQ6q2VQnODy/CrUrf7SAPcypscgXlwU/za6 U1Hz+L8CjiXZq828Dux6i4fQg2QUnRep5wiiAasb/LkxCuMOd6A9tSwppD68uOZWR5BK sqoA== X-Gm-Message-State: ACgBeo2y0poyFh6FW18/mDoPm/51QmrLL12f0yuZ4uikmkzo/yx3X7TJ Qa0tVEKbeko6kZVB7QGLUlbMfQ== X-Received: by 2002:a63:88c3:0:b0:42b:33f8:6bc2 with SMTP id l186-20020a6388c3000000b0042b33f86bc2mr23258567pgd.495.1661983462486; Wed, 31 Aug 2022 15:04:22 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id a14-20020a170902710e00b0016d150c6c6dsm11999017pll.45.2022.08.31.15.04.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Aug 2022 15:04:21 -0700 (PDT) Date: Wed, 31 Aug 2022 15:04:20 -0700 From: Kees Cook To: Sami Tolvanen Cc: linux-kernel@vger.kernel.org, Josh Poimboeuf , Peter Zijlstra , x86@kernel.org, Catalin Marinas , Will Deacon , Mark Rutland , Nathan Chancellor , Nick Desaulniers , Joao Moreira , Sedat Dilek , Steven Rostedt , linux-hardening@vger.kernel.org, linux-arm-kernel@lists.infradead.org, llvm@lists.linux.dev Subject: Re: [PATCH v4 00/21] KCFI support Message-ID: <202208311503.62B2C1BC@keescook> References: <20220830233129.30610-1-samitolvanen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220830233129.30610-1-samitolvanen@google.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 30, 2022 at 04:31:08PM -0700, Sami Tolvanen wrote: > KCFI is a forward-edge control-flow integrity scheme in the upcoming > Clang 16 release, which is more suitable for kernel use than the > existing CFI scheme used by CONFIG_CFI_CLANG. KCFI doesn't require > LTO, doesn't alter function references to point to a jump table, and > won't break function address equality. > > This series replaces the current arm64 CFI implementation with KCFI > and adds support for x86_64. > > KCFI requires assembly functions that are indirectly called from C > code to be annotated with type identifiers. As type information is > only available in C, the compiler emits expected type identifiers > into the symbol table, so they can be referenced from assembly > without having to hardcode type hashes. Patch 6 adds helper macros > for annotating functions, and patches 9 and 19 add annotations. > > In case of a type mismatch, KCFI always traps. To support error > handling, the compiler generates a .kcfi_traps section for x86_64, > which contains the locations of each trap, and for arm64, encodes > the necessary register information to the ESR. Patches 10 and 21 add > arch-specific error handlers. > > To test this series, you'll a ToT Clang toolchain. The series is > also available in GitHub: > > https://github.com/samitolvanen/linux/commits/kcfi-v4 This happily runs through all my initial testing hoops. :) Tested-by: Kees Cook -- Kees Cook