Re: [PATCH v2] rust: add flags for shadow call stack sanitizer

Alice Ryhl
2024-04-30T11:09:30Z

Will Deacon <will@kernel.org> wrote:
> On Tue, Mar 05, 2024 at 01:14:19PM +0100, Miguel Ojeda wrote:
>> Otherwise partially reverting to the `target.json` approach sounds good too.
>>
>> I added the `-Zuse-sync-unwind=n` to the list at
>> https://github.com/Rust-for-Linux/linux/issues/2. Given the default is
>> what we want, I have put it in the "Good to have" section.
>
> I think we have time to do this properly, like we did for the clang
> enablement a few years ago. In hindsight, avoiding hacks for the early
> toolchains back then was a really good idea because it meant we could
> rely on a solid baseline set of compiler features from the start.
>
> So, please can we fix this in rustc and just have SCS dependent on that?

Hi Will,

Just to keep you in the loop, I've posted a PR to make rustc recognize
the reserve-x18 target feature, so that the -Ctarget-feature=+reserve-x18
flag stops emitting a warning.

This should be sufficient for adding support for CONFIG_DYNAMIC_SCS.

You can find it here:
https://github.com/rust-lang/rust/pull/124323

As for non-dynamic SCS, I plan to tackle that after the PR is merged.
See the "Future possibilities" section in the linked PR for more info on
that.

Alice