Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2359585rdb; Tue, 10 Oct 2023 01:13:10 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGPI7aS1yuf6DapnRWhN+zriAPttU+AGt2PcuW8EZse8ME+TdGj2QV5t+xzJw8sdGNDAxC8 X-Received: by 2002:a17:903:1ca:b0:1c6:1a26:ef56 with SMTP id e10-20020a17090301ca00b001c61a26ef56mr19293029plh.48.1696925589654; Tue, 10 Oct 2023 01:13:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696925589; cv=none; d=google.com; s=arc-20160816; b=jMWaVZMOZHjYksEbwEpjGY6h4wLOFIjhriFQvM9FOmuHvHBN4dHzQ9QjosYBDY3arl BGOkdMqNwlEjAjqceDw/vaYG3JKYU00Pe7YSr4uqZyJdvaLrXiIsPrjRT65Gr/TB1ccd WsL6yYpwwDJT6V71TX8HzBNyouT6F5alI13sZhFiewZ1jzBKk4R0e+0OmN67AuJpUGqm UHKg4j5N5W/GthCrvxGRl/OQsUbwjtgCdQ4eh5E6/dpQuCY4ZJY5tC3LVDfLwct3sJIW K4npEA+BUSB1hDnL778dQIoaRlUKMQY0WrpdCmKcId6eqoeDVK7b+WvfxkIKsqGzSN31 ghDA== 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=PV5bBWwhGn2puA47DlzssLedbM0lpZgwBXeayCliFs4=; fh=sQVUS9jgxPtcknF3+v78kiJ0Jm9IJlR2DqZB9CYJikw=; b=snLdHD2/PggzKZmjwUtsNNKvofV1kr2X3xM9egSPEnT5Ex/5Lw2AOkV7OPH45cu6/8 7+wr8KjXvjCQpeu9YQ23ux64T4aTSScjCJ5pQbhs7IxN0IKcICeK7ZOI0llqggMjiDcR rBwnJ6cgNC1t0uBJLZVSVDZilRDmQwBwQUrxaxboCc3GsoQJdRQ5C5zWsBNkhPulMdss hfLSKexqvLyWNeMRnWXxThLVIA7ugwbx2RTquDpSRZukcU+k/CYOLDSRB0PcycgphCFe 4K2UIgK46qyWWLbI/M47CRaE9QcI/tR0r7sQLSx3seqZjRahUjk+n7mbSD9KuX6A1LG3 vvfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=l9MVUl25; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id ko16-20020a17090307d000b001c7361b71c9si11057673plb.114.2023.10.10.01.13.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 01:13:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=l9MVUl25; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 4B204812AD39; Tue, 10 Oct 2023 01:13:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1442660AbjJJIND (ORCPT + 99 others); Tue, 10 Oct 2023 04:13:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378097AbjJJINB (ORCPT ); Tue, 10 Oct 2023 04:13:01 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51BE597; Tue, 10 Oct 2023 01:13:00 -0700 (PDT) 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=PV5bBWwhGn2puA47DlzssLedbM0lpZgwBXeayCliFs4=; b=l9MVUl25pttq5mJ76VwM+f6Gms XKRlUkOf555nICE7NLGCuwY00h9MeJ0csQBHIjRJ3+hrUKOJotDjECDRD7ZofAmxVE9ZgLlQmZjJS btUiPXjERyox7NhjS0Z9tzTxTFoXqoQMzQFRKyruBZuHdjQTP2tcjTnG1HJDllivs4ie5T+4wozQ3 NgpiCD/S3mBoDO6CW90OJ2si6YwNL+4BaABM0CO5jdYgaNwtF8Hd7ICRfK9vkkDOkXJw8boVvWe8F ScD6O2nx60knalPjg/ioPci1xE6vltfnLO3emJaucWB3h31cb6qMcbHJJdVOmaVk9rSp9CbZrvTnT Llm9lRyw==; 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 1qq7qm-003T1w-JI; Tue, 10 Oct 2023 08:12:20 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 45B9B300392; Tue, 10 Oct 2023 10:12:20 +0200 (CEST) Date: Tue, 10 Oct 2023 10:12:20 +0200 From: Peter Zijlstra To: Matthew Maurer Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , "H. Peter Anvin" , Boqun Feng , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , Alice Ryhl , linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org Subject: Re: [PATCH] x86: Enable IBT in Rust if enabled in C Message-ID: <20231010081220.GD377@noisy.programming.kicks-ass.net> References: <20231009224347.2076221-1-mmaurer@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231009224347.2076221-1-mmaurer@google.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,URIBL_BLOCKED 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 10 Oct 2023 01:13:08 -0700 (PDT) On Mon, Oct 09, 2023 at 10:42:54PM +0000, Matthew Maurer wrote: > These flags are not made conditional on compiler support because at the > moment exactly one version of rustc supported, and that one supports > these flags. > > Building without these additional flags will manifest as objtool > printing a large number of errors about missing ENDBR and if CFI is > enabled (not currently possible) will result in incorrectly structured > function prefixes. Well, I would also imagine running it on actual IBT enabled hardware will get you a non-booting kernel. > Signed-off-by: Matthew Maurer > --- > > Split out the IBT additions as per > https://lkml.kernel.org/linux-fsdevel/CANiq72kK6ppBE7j=z7uua1cJMKaLoR5U3NUAZXT5MrNEs9ZhfQ@mail.gmail.com/ > > arch/x86/Makefile | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/x86/Makefile b/arch/x86/Makefile > index 5bfe5caaa444..941f7abf6dbf 100644 > --- a/arch/x86/Makefile > +++ b/arch/x86/Makefile > @@ -81,6 +81,7 @@ ifeq ($(CONFIG_X86_KERNEL_IBT),y) > # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104816 > # > KBUILD_CFLAGS += $(call cc-option,-fcf-protection=branch -fno-jump-tables) > +KBUILD_RUSTFLAGS += -Zcf-protection=branch -Zno-jump-tables One question, -Zcf-protection=branch, will that ever emit NOTRACK prefix? The kernel very explicitly does not support (enable) NOTRACK. > else > KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none) > endif > -- > 2.42.0.609.gbb76f46606-goog >