[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4ce8f5f2-4196-43e7-88a2-0b5fa2af37fb@acm.org>
Date: Thu, 6 Feb 2025 13:29:17 -0800
From: Bart Van Assche <bvanassche@....org>
To: Marco Elver <elver@...gle.com>
Cc: "Paul E. McKenney" <paulmck@...nel.org>,
Alexander Potapenko <glider@...gle.com>, Bill Wendling <morbo@...gle.com>,
Boqun Feng <boqun.feng@...il.com>, Dmitry Vyukov <dvyukov@...gle.com>,
Frederic Weisbecker <frederic@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Ingo Molnar <mingo@...nel.org>, Jann Horn <jannh@...gle.com>,
Joel Fernandes <joel@...lfernandes.org>, Jonathan Corbet <corbet@....net>,
Josh Triplett <josh@...htriplett.org>, Justin Stitt
<justinstitt@...gle.com>, Kees Cook <kees@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Miguel Ojeda <ojeda@...nel.org>, Nathan Chancellor <nathan@...nel.org>,
Neeraj Upadhyay <neeraj.upadhyay@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Peter Zijlstra <peterz@...radead.org>, Steven Rostedt <rostedt@...dmis.org>,
Thomas Gleixner <tglx@...utronix.de>, Uladzislau Rezki <urezki@...il.com>,
Waiman Long <longman@...hat.com>, Will Deacon <will@...nel.org>,
kasan-dev@...glegroups.com, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev, rcu@...r.kernel.org, linux-crypto@...r.kernel.org
Subject: Re: [PATCH RFC 07/24] cleanup: Basic compatibility with capability
analysis
On 2/6/25 10:10 AM, Marco Elver wrote:
> @@ -243,15 +243,18 @@ const volatile void * __must_check_fn(const volatile void *val)
> #define DEFINE_CLASS(_name, _type, _exit, _init, _init_args...) \
> typedef _type class_##_name##_t; \
> static inline void class_##_name##_destructor(_type *p) \
> + __no_capability_analysis \
> { _type _T = *p; _exit; } \
> static inline _type class_##_name##_constructor(_init_args) \
> + __no_capability_analysis \
> { _type t = _init; return t; }
guard() uses the constructor and destructor functions defined by
DEFINE_GUARD(). The DEFINE_GUARD() implementation uses DEFINE_CLASS().
Here is an example that I found in <linux/mutex.h>:
DEFINE_GUARD(mutex, struct mutex *, mutex_lock(_T), mutex_unlock(_T))
For this example, how is the compiler told that mutex _T is held around
the code protected by guard()?
Thanks,
Bart.
Powered by blists - more mailing lists