Re: [PATCH 1/2] rust: kasan: do not pass -Zsanitizer-recover
From: Alice Ryhl
Date: Fri Mar 27 2026 - 07:12:02 EST
On Wed, Mar 25, 2026 at 3:30 PM Gary Guo <gary@xxxxxxxxxxx> wrote:
>
> On Wed Mar 25, 2026 at 2:04 PM GMT, Danilo Krummrich wrote:
> > On Wed Mar 25, 2026 at 12:47 PM CET, Alice Ryhl wrote:
> >> On Wed, Mar 25, 2026 at 12:06:50PM +0100, Danilo Krummrich wrote:
> >>> On Wed Mar 25, 2026 at 10:26 AM CET, Alice Ryhl wrote:
> >>> > We do not pass -fsanitize-recover to clang, so for consistency we should
> >>> > not pass -Zsanitizer-recover to rustc. Thus, remove these flags.
> >>>
> >>> Isn't this because clang forces it regardless? Is this true for rustc as well?
> >>
> >> I forgot to mention this in commit, but I'm actually a bit confused
> >> about the situation here. If clang forces it somehow, how?
> >
> > I previously had a very brief look at the source code and came across this [1],
> > where
> >
> > static const SanitizerMask AlwaysRecoverable = SanitizerKind::KernelAddress |
> > SanitizerKind::KernelHWAddress |
> > SanitizerKind::KCFI;
> >
> > But again, I only had a very brief look and it might well be that I got this
> > wrong.
> >
> > [1] https://github.com/llvm/llvm-project/blob/main/clang/lib/Driver/SanitizerArgs.cpp#L750
> >
> >> I don't think rustc does anything like that, but not sure. If it doesn't, but
> >> clang does, then maybe rustc should too? Depends on how that happens.
>
> It looks like there's no similar logic, and Rustc is passing recoverable
> settings based on the command line options:
>
> https://github.com/rust-lang/rust/blob/8a703520e80d87d4423c01f9d4fbc9e5f6533a02/compiler/rustc_codegen_llvm/src/back/write.rs#L644
Based on
https://lore.kernel.org/all/202603271853.RhfDTdOp-lkp@xxxxxxxxx/
it seems like you all are right. There is a rustc/clang difference here.
Alice