Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4031955rdb; Mon, 11 Dec 2023 07:08:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9V1kii7tonymxKXGu59xb5EhBKIk/DcDT39xU8TlvlTtv08eTRk1jXq9s35mV1AfSfLUu X-Received: by 2002:a05:6a00:1385:b0:6ce:63ff:50f0 with SMTP id t5-20020a056a00138500b006ce63ff50f0mr5168358pfg.37.1702307293147; Mon, 11 Dec 2023 07:08:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702307293; cv=none; d=google.com; s=arc-20160816; b=e/hwUgFyuKkB6ZqmKbdK5oGeS+kjqeEwHEizU6g6ntehvJ8GHJbp7PzOGEThU2V5xO uaeTuRFCgvHMBhayFoQduNyFk6Ujb/kAKHW3XvfvMvI8SL14wdkrIbBC70o7Q62w3H8k 2nDaF7NkdkPNnYNSvgwnBEXq4GdHs1Rzl6FItwYkTuTbH2shcIXGemINNMyd8eu0tEg9 /Zb5/wyhOIVPZMrzIFovW1yxS0+IAaM8B6PejBp25rmwQdJpxQ4iptkg036Q7PDFsQxy dfgiWRY1T1Jc1KSARA8tbgA8lqmNyNrPebDrrv4dsoEwoA1YQusCXYgqaCQaC1aeRH6i p1gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=kG29XMk3lTrWBF1GpEp92hAzbHx2RURAGojiIVdfRzw=; fh=ZbS34ZXK32mYaEsXBJXWvIJ7gD0Wx2Yn9gQJx/lvfoc=; b=GYDuEOqdxT4/wI/nW5HN9DT5lQA7uR9usJuTVxYS4JwqDNGq49zZ5+fn0CF0kfvtjH WJfMhhI0ss46hqX67hhfwxmJYoa6eusHV+KmlvquDvwxaYhSrw9hehX4o2mA3XNnJ6o6 4+lC0dulFao4l8F161LFN/eqbs8OOSgjsWq0KsnDBTl32GaxGida7CWnCeL0X7kV//Sz rhvPMmxSqKybPuilim6oRfazk1MaOcLn5mUQT9/lvTQPj+ERQ1/GYXGnif2YrdJ/OHAn i7mP7MHKsEqtIMTPBUNqNv+7kA2ZMPAsb5e6AIQ14xq89RC4UePb94xf2Pru8YyvDVJo 4mLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=mMk0d+CF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id 4-20020a631544000000b005b90e67f438si6111944pgv.106.2023.12.11.07.08.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 07:08:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=mMk0d+CF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 3502C808D20D; Mon, 11 Dec 2023 07:08:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343966AbjLKPHw (ORCPT + 99 others); Mon, 11 Dec 2023 10:07:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343865AbjLKPHv (ORCPT ); Mon, 11 Dec 2023 10:07:51 -0500 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73716CF for ; Mon, 11 Dec 2023 07:07:57 -0800 (PST) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-dbc5f7781faso1933481276.1 for ; Mon, 11 Dec 2023 07:07:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1702307276; x=1702912076; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=kG29XMk3lTrWBF1GpEp92hAzbHx2RURAGojiIVdfRzw=; b=mMk0d+CFvuFQRNww/Zwa8Y4syNdv2EZe3KAgWqe35+lpTCdXFnwz6HqhnKkxY+q+jj QpXC8pM1AGnqJa+Uu/JEZatWYzfLjJU6MufThSFhw7KlupHtt8c2sB8DFeGmTS7UoCVh HKXls9wnaCFmFvq1LoaqPRByTPNXdZyKjTpezWjjxHLE1ivkydgx6i2XkHhaRNBoi1Hr kUf1OCSwgTkhk8E/eDfG6inlw6SFcvmnDCzD2OwNQQ5kD8mG7v6CaF71VO6uow8citWe U5zUxvMBHWi9B7uFZjka+BCphBAlxI8UfiNI2McZ879N8mDokG8HGk/HgLhsbYtJy8Xs WS0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702307276; x=1702912076; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=kG29XMk3lTrWBF1GpEp92hAzbHx2RURAGojiIVdfRzw=; b=jmqWJDhUGEjAS3fBlw1u4nGOec0g5SaoQrgVnonfGMCdhH17MmM23NdlgTHycqh0Lm mpk5NDe/qnVQUBroTOE2Pg5UJtMRi0LVa9nrQm74XSAamQgQGXCS3kA6OIJZPGT4KpiB qzvOR3Ff180JCXGs6H/ODBGMicLkxoppYD/Gxhnc3TsWgX5Whsy4QfaFjiDvobkOPdh9 SyqbvNAhm6damlXvtlRqWSAb3InbyjXvDq5kZmSQlQynHYH3rr2IEkToU6XcMwr5KfoO JYgNEQn6e16KN8O2iJz8UkRTVjT1gWW9ANHO1An58oEnVUTg9wFC6xWMGSgSN1ZH0jdx J4oQ== X-Gm-Message-State: AOJu0YzlSW1CG0NwlY/vVZ5uetGSeK/HvIQamn095iUlS3Jd0NPQjAXA Anx1IA/zoF4OA7aYTw5BGQQGD9m8yvAa X-Received: from anyblade.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:1791]) (user=mmaurer job=sendgmr) by 2002:a05:6902:242:b0:d9a:ec95:9687 with SMTP id k2-20020a056902024200b00d9aec959687mr30873ybs.11.1702307276664; Mon, 11 Dec 2023 07:07:56 -0800 (PST) Date: Mon, 11 Dec 2023 15:07:49 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog Message-ID: <20231211150753.293883-1-mmaurer@google.com> Subject: [PATCH] x86/Kconfig: rust: Patchable function Rust compat From: Matthew Maurer To: Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho Cc: Matthew Maurer , "H. Peter Anvin" , Boqun Feng , Gary Guo , "=?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?=" , Benno Lossin , Andreas Hindborg , Alice Ryhl , linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email 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 (lipwig.vger.email [0.0.0.0]); Mon, 11 Dec 2023 07:08:04 -0800 (PST) Rust doesn't yet support patchable entry, but likely will soon. Disable function padding when Rust is used but doesn't support it, and propagate the flag when it does. Signed-off-by: Matthew Maurer --- arch/x86/Kconfig | 6 +++++- arch/x86/Makefile | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 18b9fb7df95b..e9f1814217b5 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -2452,6 +2452,10 @@ config CC_HAS_RETURN_THUNK config CC_HAS_ENTRY_PADDING def_bool $(cc-option,-fpatchable-function-entry=16,16) +config RUSTC_HAS_ENTRY_PADDING + depends RUST + def_bool $(rs-option,-Zpatchable-function-entry=16,16) + config FUNCTION_PADDING_CFI int default 59 if FUNCTION_ALIGNMENT_64B @@ -2469,7 +2473,7 @@ config FUNCTION_PADDING_BYTES config CALL_PADDING def_bool n - depends on CC_HAS_ENTRY_PADDING && OBJTOOL + depends on CC_HAS_ENTRY_PADDING && (!RUST || RUST_HAS_ENTRY_PADDING) && OBJTOOL select FUNCTION_ALIGNMENT_16B config FINEIBT diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 1a068de12a56..0228af62742e 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -211,7 +211,9 @@ endif ifdef CONFIG_CALL_PADDING PADDING_CFLAGS := -fpatchable-function-entry=$(CONFIG_FUNCTION_PADDING_BYTES),$(CONFIG_FUNCTION_PADDING_BYTES) +PADDING_RUSTFLAGS := -Zpatchable-function-entry=$(CONFIG_FUNCTION_PADDING_BYTES),$(CONFIG_FUNCTION_PADDING_BYTES) KBUILD_CFLAGS += $(PADDING_CFLAGS) +KBUILD_RUSTFLAGS += $(PADDING_RUSTFLAGS) export PADDING_CFLAGS endif -- 2.43.0.472.g3155946c3a-goog