[PATCH v4 02/35] compiler-context-analysis: Add infrastructure for Context Analysis with Clang

Peter Zijlstra peterz at infradead.org
Thu Dec 11 11:44:31 UTC 2025


On Thu, Nov 20, 2025 at 03:49:04PM +0100, Marco Elver wrote:
> +/**
> + * __guarded_by - struct member and globals attribute, declares variable
> + *                only accessible within active context
> + *
> + * Declares that the struct member or global variable is only accessible within
> + * the context entered by the given context guard. Read operations on the data
> + * require shared access, while write operations require exclusive access.
> + *
> + * .. code-block:: c
> + *
> + *	struct some_state {
> + *		spinlock_t lock;
> + *		long counter __guarded_by(&lock);
> + *	};
> + */
> +# define __guarded_by(...)		__attribute__((guarded_by(__VA_ARGS__)))

I must express pure hatred for this '.. code-block:: c' thing.



More information about the Linux-security-module-archive mailing list