[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240915123626.1a170103.gary@garyguo.net>
Date: Sun, 15 Sep 2024 12:36:26 +0100
From: Gary Guo <gary@...yguo.net>
To: Dirk Behme <dirk.behme@...il.com>
Cc: Alice Ryhl <aliceryhl@...gle.com>, Conor Dooley <conor@...nel.org>,
Miguel Ojeda <miguel.ojeda.sandonis@...il.com>, Paul Walmsley
<paul.walmsley@...ive.com>, Palmer Dabbelt <palmer@...belt.com>, Albert Ou
<aou@...s.berkeley.edu>, Catalin Marinas <catalin.marinas@....com>, Will
Deacon <will@...nel.org>, Ard Biesheuvel <ardb@...nel.org>, Jamie Cunliffe
<Jamie.Cunliffe@....com>, Sami Tolvanen <samitolvanen@...gle.com>, Nathan
Chancellor <nathan@...nel.org>, Kees Cook <kees@...nel.org>, Masahiro
Yamada <masahiroy@...nel.org>, Nicolas Schier <nicolas@...sle.eu>, Marc
Zyngier <maz@...nel.org>, Mark Rutland <mark.rutland@....com>, Mark Brown
<broonie@...nel.org>, Nick Desaulniers <ndesaulniers@...gle.com>, Miguel
Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>, Wedson
Almeida Filho <wedsonaf@...il.com>, Boqun Feng <boqun.feng@...il.com>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>, Benno Lossin
<benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...sung.com>,
Valentin Obst <kernel@...entinobst.de>, linux-kbuild@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
rust-for-linux@...r.kernel.org, linux-riscv
<linux-riscv@...ts.infradead.org>
Subject: Re: [PATCH v7] rust: support for shadow call stack sanitizer
On Sun, 15 Sep 2024 09:32:44 +0200
Dirk Behme <dirk.behme@...il.com> wrote:
> Yes, it is unrelated to this change. It is PREEMPT_RT usage related. I
> think we could add something like
>
> #ifdef CONFIG_PREEMPT_RT
> void rust_helper___mutex_init(struct mutex *mutex, const char *name,
> struct lock_class_key *key)
> {
> return __mutex_init(mutex, name, key);
> }
> #endif
There's no need to use `ifdef` here (we don't want to try replicate all
ifdefs). Simply add a helper is sufficient. We have logic in
rust/bindings/lib.rs to prefer externed function to helpers if an
externed function exist.
Best,
Gary
>
> to helpers to fix
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/rust/kernel/sync/lock/mutex.rs?&id=6d20d629c6d8575be98eeebe49a16fb2d7b32350
>
> ?
>
> Explanation: Looking at
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/linux/mutex.h?#n52
>
> we have (simplified)
>
> #ifndef CONFIG_PREEMPT_RT
> extern void __mutex_init(struct mutex *lock, const char *name,
> struct lock_class_key *key);
> #else
> #define __mutex_init(mutex, name, key) \
> do { \
> rt_mutex_base_init(&(mutex)->rtmutex); \
> __mutex_rt_init((mutex), name, key); \
> } while (0)
> #endif
>
> So in the CONFIG_PREEMPT_RT case bindgen doesn't resolve the macro
> what could be fixed by adding a helper.
>
> Dirk
Powered by blists - more mailing lists