rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benno Lossin <benno.lossin@proton.me>
To: Miguel Ojeda <ojeda@kernel.org>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Masahiro Yamada <masahiroy@kernel.org>
Cc: x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Nicolas Schier" <nicolas@fjasle.eu>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Andreas Hindborg" <a.hindborg@samsung.com>,
	"Alice Ryhl" <aliceryhl@google.com>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	patches@lists.linux.dev, linux-kbuild@vger.kernel.org
Subject: Re: [PATCH v2 0/6] Rust: support `CPU_MITIGATIONS` and enable `objtool`
Date: Wed, 24 Jul 2024 21:51:57 +0000	[thread overview]
Message-ID: <e51f3b91-690d-4b72-9841-75a61684777d@proton.me> (raw)
In-Reply-To: <20240724161501.1319115-1-ojeda@kernel.org>

On 24.07.24 18:14, Miguel Ojeda wrote:
> Hi,
> 
> This is an updated series to the CPU mitigations support for Rust. It
> also has the patch to enable `objtool`, so that we can start running it
> for Rust.
> 
> It would be nice to get this applied soon, so that we start being
> warning-free (since we already get warnings under IBT builds via
> `vmlinux.o`). I am happy to take it through the Rust tree if the x86 and
> objtool maintainers give an Acked-by, or through any of the other trees,
> as you prefer. Otherwise, I think at this point we would need to make
> Rust exclusive to the mitigations, which isn't great.
> 
> With this series, again, x86_64 is warning-free with `objtool` enabled. I
> tested `-O2`/`-Os` and the Rust versions we support under `-O2` (mainly
> for the `noreturn` patch, which uses heuristics), as well as IBT vs. no
> IBT (i.e.  running on individual object files vs. in `vmlinux`). I also
> did an arm64 build.
> 
> Testing is very welcome for this one!
> 
> Cheers,
> Miguel
> 
> v2:
>   - Add patch to enable `objtool` for Rust.
> 
>   - Add patch to list `noreturn` Rust functions (via heuristics) to avoid
>     warnings related to that.
> 
>   - Make the `RETHUNK` patch not an RFC since the Rust compiler has
>   support for
>     it now.
> 
>   - Update the names of the migitation config symbols, given the changes
>   at e.g.
>     commit 7b75782ffd82 ("x86/bugs: Rename CONFIG_MITIGATION_SLS =>
>     CONFIG_MITIGATION_SLS").
> 
> 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: 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           | 36 ++++++++++++++++++++++++++++++++-
>  tools/objtool/noreturns.h       |  2 ++
>  7 files changed, 91 insertions(+), 12 deletions(-)
> 
> 
> base-commit: b1263411112305acf2af728728591465becb45b0
> --
> 2.45.2
> 

I tested this series with a config that produces the objtool warnings on
b126341 and it worked flawlessly. I also tried `-O2` and `-Os`:

Tested-by: Benno Lossin <benno.lossin@proton.me>

---
Cheers,
Benno


  parent reply	other threads:[~2024-07-24 21:52 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-24 16:14 [PATCH v2 0/6] Rust: support `CPU_MITIGATIONS` and enable `objtool` Miguel Ojeda
2024-07-24 16:14 ` [PATCH v2 1/6] rust: module: add static pointer to `{init,cleanup}_module()` Miguel Ojeda
2024-07-24 19:46   ` Gary Guo
2024-07-25 17:44     ` Miguel Ojeda
2024-07-25 17:46       ` Miguel Ojeda
2024-07-25 17:47     ` Miguel Ojeda
2024-07-30 11:18       ` Gary Guo
2024-07-24 16:14 ` [PATCH v2 2/6] x86/rust: support MITIGATION_RETPOLINE Miguel Ojeda
2024-07-24 19:38   ` Gary Guo
2024-07-24 16:14 ` [PATCH v2 3/6] x86/rust: support MITIGATION_RETHUNK Miguel Ojeda
2024-07-24 19:40   ` Gary Guo
2024-07-24 16:14 ` [PATCH v2 4/6] x86/rust: support MITIGATION_SLS Miguel Ojeda
2024-07-24 19:42   ` Gary Guo
2024-07-24 16:14 ` [PATCH v2 5/6] objtool: list `noreturn` Rust functions Miguel Ojeda
2024-07-24 19:35   ` Gary Guo
2024-07-25  8:33     ` Peter Zijlstra
2024-08-21 15:28       ` Gary Guo
2024-07-24 16:14 ` [PATCH v2 6/6] objtool/kbuild/rust: enable objtool for Rust Miguel Ojeda
2024-07-24 21:51 ` Benno Lossin [this message]
2024-07-25  8:38 ` [PATCH v2 0/6] Rust: support `CPU_MITIGATIONS` and enable `objtool` Peter Zijlstra
2024-07-25  9:53   ` Miguel Ojeda
2024-07-25  9:43 ` Alice Ryhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e51f3b91-690d-4b72-9841-75a61684777d@proton.me \
    --to=benno.lossin@proton.me \
    --cc=a.hindborg@samsung.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=gary@garyguo.net \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=mingo@redhat.com \
    --cc=nathan@kernel.org \
    --cc=nicolas@fjasle.eu \
    --cc=ojeda@kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=peterz@infradead.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=wedsonaf@gmail.com \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).