|
|
Subscribe / Log in / New account

Rust: support `CPU_MITIGATIONS` and enable `objtool`

From:  Miguel Ojeda <ojeda-AT-kernel.org>
To:  Josh Poimboeuf <jpoimboe-AT-kernel.org>, Peter Zijlstra <peterz-AT-infradead.org>, Thomas Gleixner <tglx-AT-linutronix.de>, Ingo Molnar <mingo-AT-redhat.com>, Borislav Petkov <bp-AT-alien8.de>, Dave Hansen <dave.hansen-AT-linux.intel.com>, Masahiro Yamada <masahiroy-AT-kernel.org>
Subject:  [PATCH v3 0/6] Rust: support `CPU_MITIGATIONS` and enable `objtool`
Date:  Thu, 25 Jul 2024 20:33:17 +0200
Message-ID:  <20240725183325.122827-1-ojeda@kernel.org>
Cc:  x86-AT-kernel.org, "H. Peter Anvin" <hpa-AT-zytor.com>, Nathan Chancellor <nathan-AT-kernel.org>, Nicolas Schier <nicolas-AT-fjasle.eu>, Miguel Ojeda <ojeda-AT-kernel.org>, Wedson Almeida Filho <wedsonaf-AT-gmail.com>, Alex Gaynor <alex.gaynor-AT-gmail.com>, Boqun Feng <boqun.feng-AT-gmail.com>, Gary Guo <gary-AT-garyguo.net>, Björn Roy Baron <bjorn3_gh-AT-protonmail.com>, Benno Lossin <benno.lossin-AT-proton.me>, Andreas Hindborg <a.hindborg-AT-samsung.com>, Alice Ryhl <aliceryhl-AT-google.com>, rust-for-linux-AT-vger.kernel.org, linux-kernel-AT-vger.kernel.org, patches-AT-lists.linux.dev, linux-kbuild-AT-vger.kernel.org
Archive-link:  Article

Hi,

This is just v2 with the helper function suggested by Peter.

I dropped Benno's and Alice's Tested-bys from the modified patch, just
in case, but the logic should be equivalent.

Cheers,
Miguel

v3:
  - Added `is_rust_noreturn()` helper function (Peter).
  - Reworded a couple bits.

v2: https://lore.kernel.org/rust-for-linux/20240724161501.131...
v1: https://lore.kernel.org/rust-for-linux/20231023174449.251...

Miguel Ojeda (6):
  rust: module: add static pointer to `{init,cleanup}_module()`
  x86/rust: support MITIGATION_RETPOLINE
  x86/rust: support MITIGATION_RETHUNK
  x86/rust: support MITIGATION_SLS
  objtool/rust: list `noreturn` Rust functions
  objtool/kbuild/rust: enable objtool for Rust

 arch/x86/Makefile               |  7 ++++-
 rust/Makefile                   | 22 +++++++++------
 rust/macros/module.rs           | 12 +++++++++
 scripts/Makefile.build          |  9 +++++--
 scripts/generate_rust_target.rs | 15 +++++++++++
 tools/objtool/check.c           | 48 ++++++++++++++++++++++++++++++++-
 tools/objtool/noreturns.h       |  2 ++
 7 files changed, 103 insertions(+), 12 deletions(-)


base-commit: b1263411112305acf2af728728591465becb45b0
--
2.45.2



Copyright © 2024, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds