From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 92BDBC32771 for ; Mon, 26 Sep 2022 12:40:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oTv/NX9V2db3Tcb1FbnSXKlLh4azjEhan07+KDrCO2Q=; b=S3a47WfQHxYyDZ kYigVi5nIc5NzchAj9e76iEgFCcs5XDfloKR3jeXTARvrGLKzCEPReBXH7EbTM77q5FYyaiPOp9EP P3LBb/BjrcYeYr+y+jTZEgV+9R2VcFJW3IanlgSdr9CbAcclGabu4eny/EaXP94J0fIqSy754ZV16 RSh8fHEmDst7P8d0NL2tqybmIZS+aUpoT2JBLS7Zz8ZTqxHfjXOmvWQlY0HIB84j6i2rWB/U3+E4D b5xpF0AvckM1jb0cACMtLi16pd0Rpmfb/k3NAVG0TRWe8ckRV7JU4osms8aZyFzNu9kinsPmwJ69q HRhYGNmBGWHEEuPklYwA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ocnOT-004qna-TE; Mon, 26 Sep 2022 12:39:30 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ocnOS-004qn8-PZ for linux-arm-kernel@bombadil.infradead.org; Mon, 26 Sep 2022 12:39:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=FIHRxSY6V+zzl15F4vvObYqxHLfDtkzR9cwonipMTy4=; b=gvrdtGfYanGL5Zv0aDMToZN85f +xqWVNEQnFt5COC6g8v2Vtsw900/hQjSCEAAArEl6LemRrxzyUmGTygvB3+ujY6oKmZ/odrLtahEP eaadMPRHDyYAxjCQTSbwEy9sx3Pc63jDaDiW7hyaauMFMqP2ESXJ/gIpdKDUgSqzsDhwAK4n2VayX Bv+UrTWjnmSk4cGEo8bv3xtK4yWhx2vqhtQkLAUV5ia8PlWKA90afqen7TRND7r436u/quR21gItg bN2orRDwoMTEjyFEI7brjAbFTHf5TalCLcTC1skSRts4y7bThtfeyIEGT2haZaPPAQbwxqk+IskVd UdQAQmRg==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ocnOQ-00ASmC-3H; Mon, 26 Sep 2022 12:39:26 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 81D9D3002F1; Mon, 26 Sep 2022 14:39:21 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 41A152B123E2B; Mon, 26 Sep 2022 14:39:21 +0200 (CEST) Date: Mon, 26 Sep 2022 14:39:21 +0200 From: Peter Zijlstra To: Sami Tolvanen Cc: linux-kernel@vger.kernel.org, Kees Cook , Josh Poimboeuf , 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, hjl.tools@gmail.com Subject: Re: [PATCH v5 00/22] KCFI support Message-ID: References: <20220908215504.3686827-1-samitolvanen@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220908215504.3686827-1-samitolvanen@google.com> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Sep 08, 2022 at 02:54:42PM -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 20 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 22 add > arch-specific error handlers. > > To test this series, you'll need a ToT Clang toolchain. The series > is also available pn GitHub: > > https://github.com/samitolvanen/linux/commits/kcfi-v5 As mentioned at plumbers, my only concern is somewhat excessive use of CFI_CLANG as oposed to something more compiler neutral. But I suppose that's something we can cleanup/fix when GCC grows support for this. Acked-by: Peter Zijlstra (Intel) Tested-by: Peter Zijlstra (Intel) (as in I ran kCFI + call-depth-tracking + FineIBT on a bunch of hardware) HJL, can you look at adding kCFI support to GCC ? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel