[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACT4Y+Y+XmdNervhF5WAEyVwprJ32m7Pd8FF2fKy3K9FiTpJtQ@mail.gmail.com>
Date: Fri, 26 Jul 2024 12:23:01 +0200
From: Dmitry Vyukov <dvyukov@...gle.com>
To: Andrey Konovalov <andreyknvl@...il.com>
Cc: Matthew Maurer <mmaurer@...gle.com>, Andrey Ryabinin <ryabinin.a.a@...il.com>,
Masahiro Yamada <masahiroy@...nel.org>, Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>, Wedson Almeida Filho <wedsonaf@...il.com>,
Nathan Chancellor <nathan@...nel.org>, Alexander Potapenko <glider@...gle.com>,
Vincenzo Frascino <vincenzo.frascino@....com>, Nicolas Schier <nicolas@...sle.eu>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...sung.com>,
Alice Ryhl <aliceryhl@...gle.com>, Nick Desaulniers <ndesaulniers@...gle.com>,
Bill Wendling <morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>, kasan-dev@...glegroups.com,
linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
rust-for-linux@...r.kernel.org, llvm@...ts.linux.dev,
Brendan Higgins <brendanhiggins@...gle.com>
Subject: Re: [PATCH 2/2] kbuild: rust: Enable KASAN support
On Fri, 26 Jul 2024 at 01:57, Andrey Konovalov <andreyknvl@...il.com> wrote:
>
> On Fri, Jul 26, 2024 at 1:21 AM Matthew Maurer <mmaurer@...gle.com> wrote:
> >
> > Rust supports KASAN via LLVM, but prior to this patch, the flags aren't
> > set properly.
This is great, thanks, Matthew!
Does Rust support KUnit tests?
It would be good to add at least a simple positive test similar to the
existing ones so that the support does not get rotten soon.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/mm/kasan/kasan_test.c
> > Suggested-by: Miguel Ojeda <ojeda@...nel.org>
> > Signed-off-by: Matthew Maurer <mmaurer@...gle.com>
>
> Hi Matthew,
>
> > CFLAGS_KASAN_MINIMAL := -fsanitize=kernel-address
> > +RUSTFLAGS_KASAN_MINIMAL := -Zsanitizer=kernel-address -Zsanitizer-recover=kernel-address
>
> If I recall correctly, the reason we need CFLAGS_KASAN_MINIMAL is
> because older compilers don't support some of the additional options.
> With Rust, this shouldn't be needed, as it requires a modern compiler
> that does support all needed options. E.g., for CONFIG_KASAN_SW_TAGS,
> we also don't have the MINIMAL thing for the same reason. (Possibly,
> we also already don't need this for GENERIC KASAN, as the GCC version
> requirement was raised a few times since KASAN was introduced.)
>
> > # Now add all the compiler specific options that are valid standalone
> > CFLAGS_KASAN := $(CFLAGS_KASAN_SHADOW) \
> > $(call cc-param,asan-globals=1) \
> > $(call cc-param,asan-instrumentation-with-call-threshold=$(call_threshold)) \
> > $(call cc-param,asan-instrument-allocas=1)
> > + ifdef CONFIG_RUST
> > + RUSTFLAGS_KASAN := $(RUSTFLAGS_KASAN_SHADOW) \
> > + $(call rustc-param,asan-globals=1) \
> > + $(call rustc-param,asan-instrumentation-with-call-threshold=$(call_threshold)) \
> > + $(call rustc-param,asan-instrument-allocas=1)
>
> I'm wondering if there's a way to avoid duplicating all options for
> Rust. Perhaps, some kind of macro?
>
> Thanks!
Powered by blists - more mailing lists