[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM5zL5r-oZXYKwctjTTtWAsTPHCWzAq9vRduZ1E1L-EDMv8Rmw@mail.gmail.com>
Date: Thu, 10 Apr 2025 15:18:47 +0200
From: Paweł Anikiel <panikiel@...gle.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Sami Tolvanen <samitolvanen@...gle.com>, Kees Cook <kees@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, Ingo Molnar <mingo@...hat.com>,
Josh Poimboeuf <jpoimboe@...nel.org>, Masahiro Yamada <masahiroy@...nel.org>,
Miguel Ojeda <ojeda@...nel.org>, Thomas Gleixner <tglx@...utronix.de>, Alice Ryhl <aliceryhl@...gle.com>,
Nathan Chancellor <nathan@...nel.org>, x86@...nel.org, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org
Subject: Re: [PATCH] x86/Kconfig: make CFI_AUTO_DEFAULT depend on !RUST
On Thu, Apr 10, 2025 at 3:09 PM Peter Zijlstra <peterz@...radead.org> wrote:
>
> On Thu, Apr 10, 2025 at 02:45:26PM +0200, Peter Zijlstra wrote:
> > On Thu, Apr 10, 2025 at 02:36:02PM +0200, Peter Zijlstra wrote:
> > > On Thu, Apr 10, 2025 at 11:54:20AM +0000, Paweł Anikiel wrote:
> > > > Calling core::fmt::write() from rust code while FineIBT is enabled
> > > > results in a kernel panic:
>
> > > > This happens because core::fmt::write() calls
> > > > core::fmt::rt::Argument::fmt(), which currently has CFI disabled:
> > > >
> > > > library/core/src/fmt/rt.rs:
> > > > 171 // FIXME: Transmuting formatter in new and indirectly branching to/calling
> > > > 172 // it here is an explicit CFI violation.
> > > > 173 #[allow(inline_no_sanitize)]
> > > > 174 #[no_sanitize(cfi, kcfi)]
> > > > 175 #[inline]
> > > > 176 pub(super) unsafe fn fmt(&self, f: &mut Formatter<'_>) -> Result {
> > > >
>
> Miguel, I cannot find this code in the kernel tree. Is this again
> because Rust is not free-standing and relies on external code?
The code I referenced is from here:
https://github.com/rust-lang/rust/blob/master/library/core/src/fmt/rt.rs#L139
Powered by blists - more mailing lists