Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp983665rdg; Wed, 11 Oct 2023 10:44:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGS1LQ4Fyl8to1BD6c1v+8H7g+KcPCAOlcIRaOKu4DP6oMIVRSZAeltWSkYElu9mN0FzfmJ X-Received: by 2002:a17:90a:d707:b0:27c:e74a:a4b1 with SMTP id y7-20020a17090ad70700b0027ce74aa4b1mr5710908pju.36.1697046283201; Wed, 11 Oct 2023 10:44:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697046283; cv=none; d=google.com; s=arc-20160816; b=yoFf1/dVGM8eO1ESKHueq3YOOzJBHREFHDJlOinrI07LXhB1PEiKVJMTosKEoc94xv JEcEoTBJwvQ0rdPWRi9f/ppXH2QCoOSk1hAr0j7kNNQgJHvcawiJJu1dPmZcGoD0/Pdt WzMA5MnaNZeRtPZAG+uEhwkiRDg8JUTbF32k0m8bCfuh7vmmzK2iU/rXpKrdupftzREi Ngtp3tZlp3H3U7/TC7x6LVnpfysuqaQ9oabiTkwQXjS9iERmxwxfL4arJwwEHw5oUa9P qJQN+hJL9ilF/QGUc1szwmgXt9ahXi/vLWHi+2Qfcnma/Kf96kKzgH26PVBHBOoH69g8 XuMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=iyy+ysmQl4Bp1AUl2QIMnm0hQgXYP2CG0aAsMLq8u9A=; fh=/mPWuOG6aU9nGQ5QHXLlYUraPSd2Co5IBwet40s/QF8=; b=AsDu3SaZpiPYZeAHu/psaeq/LKuAHyUiSY64+uj3DIxNNzPbK219NruiwcCNqIhSk3 AS0hmags2iTthbbddGl6HAEgcc8kTmk4wrYy6YlmgqxMYP8uE2JbAQwDBsy8z90kj1f6 /HMMUKSJQ+ru4cYYtBGlm+Fus7BuHdE+L7CVGHpAhrSrdXHM+7e60gw0HzEjkPmWfbb9 817+ra4KCSWxq0UYSoyWWhBGW973nPqwSH9ENJLA9bTOwrUJKcUn7OF8haZEulo5q/Oa mzDBWDwK3M3DXakw99MfbENZlW/Z2e6T98pJvuHuAbOY3+Jew26zJSmSEZThcwq1FU3T /1fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HPOU8PbE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id q6-20020a17090a9f4600b0027b15e572c2si315470pjv.21.2023.10.11.10.44.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 10:44:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=HPOU8PbE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 602FC81E5901; Wed, 11 Oct 2023 10:44:42 -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 S232655AbjJKRok (ORCPT + 99 others); Wed, 11 Oct 2023 13:44:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232896AbjJKRoi (ORCPT ); Wed, 11 Oct 2023 13:44:38 -0400 Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [IPv6:2607:f8b0:4864:20::b2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF32DA4; Wed, 11 Oct 2023 10:44:35 -0700 (PDT) Received: by mail-yb1-xb2d.google.com with SMTP id 3f1490d57ef6-d9a50ac5eabso82345276.1; Wed, 11 Oct 2023 10:44:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697046275; x=1697651075; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=iyy+ysmQl4Bp1AUl2QIMnm0hQgXYP2CG0aAsMLq8u9A=; b=HPOU8PbEM/jdbLNVMg6GILqV3cuWHkwSoAy8oHcKmTeAhiB8zTTISkgdLlJ53mPMJJ qXIN9nvxI9YBuwvLREBTV1+W5XJgEUcfY2UvazkCf+9zM6UNZm6zBxQdVFJ9R+/4Jdej z+BddXkV+90HP3hjtPHZvefwGLpyYfjRI6WukjvvApL6u6N/Ua8lGGV6aHjftjbQbf5u RS8S/5SW3dFr/S9Y0RZipUlmTctngsy+RgerVnZn5ZxCC7j7Rsr7J8SvqTlkseTofQsa f1L9jAG9z75KzcB/PfRauHe/wD+Q0T+C9xiZAzHtZ99QdnE0PcaaI1cSlcVLBqTjJxeb wEQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697046275; x=1697651075; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iyy+ysmQl4Bp1AUl2QIMnm0hQgXYP2CG0aAsMLq8u9A=; b=lFSC1g9I3asg6HuSJ/u9V3uLEvV+usisnomHd46K1h8jI2RyvRZhnCBvoUAyokNGtf RR7Wm/Mj8Gn/O0/pDwHCQ/CVS128p2vtlr2xaA46ClB1uZ3tDmsPHPRTiCbH+QLRhyeU dpZ4llAi7mIto782hLUfIOcepZNKURy5PiQT9S2aqdeS0bwS49JZxV4sP2Dr5OSp8DgQ wH2d433t259b/OCFuc87oQ9UTXEbHOC/D6/du6FSr9S7yzsjGX5LL0rt0NW6ZTWWQ5Ym vg8oV4lKdPmOUTf3AuOeg8DvjxCUmq5TAXaD6chUT1U8mtEKxt2Joy0hp30GnPtRaelK TRoA== X-Gm-Message-State: AOJu0Yxq/CfQHw3Ts+GxWsGmfRjA8jGvWyTGyGVndqY/vcapDC3sScxL jKpT04NFQfyV6i29KevLNkQipi5ipzKNMyPymuc= X-Received: by 2002:a05:6902:152:b0:d9a:38b0:a0c8 with SMTP id p18-20020a056902015200b00d9a38b0a0c8mr7068973ybh.61.1697046275143; Wed, 11 Oct 2023 10:44:35 -0700 (PDT) MIME-Version: 1.0 References: <20231009224347.2076221-1-mmaurer@google.com> In-Reply-To: <20231009224347.2076221-1-mmaurer@google.com> From: Miguel Ojeda Date: Wed, 11 Oct 2023 19:44:23 +0200 Message-ID: Subject: Re: [PATCH] x86: Enable IBT in Rust if enabled in C To: Matthew Maurer Cc: peterz@infradead.org, 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 , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, Josh Poimboeuf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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]); Wed, 11 Oct 2023 10:44:42 -0700 (PDT) On Tue, Oct 10, 2023 at 12:43=E2=80=AFAM 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. > > Signed-off-by: Matthew Maurer > --- > > Split out the IBT additions as per > https://lkml.kernel.org/linux-fsdevel/CANiq72kK6ppBE7j=3Dz7uua1cJMKaLoR5U= 3NUAZXT5MrNEs9ZhfQ@mail.gmail.com/ Thanks a lot Matthew for this! It is great to see those warnings finally go away. I have added the `objtool` pass to the intermediate Rust object files and, with that + this patch applied + IBT enabled (but not rethunk/retpoline), the only thing I see is: samples/rust/rust_print.o: warning: objtool: init_module(): not an indirect call target samples/rust/rust_print.o: warning: objtool: cleanup_module(): not an indirect call target But we can fix those independently of this (ideally we want to reuse the C macros, rather than putting more complexity in `module!`), so: Acked-by: Miguel Ojeda I will send the patch for adding `objtool`. Cheers, Miguel