[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8131f46b-7115-44db-b182-9471afa67e61@linux.dev>
Date: Fri, 16 Jan 2026 09:26:49 -0800
From: Yonghong Song <yonghong.song@...ux.dev>
To: Alan Maguire <alan.maguire@...cle.com>, kees@...nel.org,
nathan@...nel.org, peterz@...radead.org, elver@...gle.com
Cc: ojeda@...nel.org, akpm@...ux-foundation.org, ubizjak@...il.com,
Jason@...c4.com, Marc.Herbert@...ux.intel.com, hca@...ux.ibm.com,
hpa@...or.com, namjain@...ux.microsoft.com, paulmck@...nel.org,
linux-kernel@...r.kernel.org, andrii.nakryiko@...il.com, ast@...nel.org,
jolsa@...nel.org, daniel@...earbox.net, martin.lau@...ux.dev,
eddyz87@...il.com, song@...nel.org, john.fastabend@...il.com,
kpsingh@...nel.org, sdf@...ichev.me, haoluo@...gle.com, bvanassche@....org,
nilay@...ux.ibm.com, bpf@...r.kernel.org
Subject: Re: [PATCH] kcsan, compiler_types: avoid duplicate type issues in BPF
Type Format
On 1/16/26 1:17 AM, Alan Maguire wrote:
> Enabling KCSAN is causing a large number of duplicate types
> in BTF for core kernel structs like task_struct [1].
> This is due to the definition in include/linux/compiler_types.h
>
> `#ifdef __SANITIZE_THREAD__
> ...
> `#define __data_racy volatile
> ..
> `#else
> ...
> `#define __data_racy
> ...
> `#endif
>
> Because some objects in the kernel are compiled without
> KCSAN flags (KCSAN_SANITIZE) we sometimes get the empty
> __data_racy annotation for objects; as a result we get multiple
> conflicting representations of the associated structs in DWARF,
> and these lead to multiple instances of core kernel types in
> BTF since they cannot be deduplicated due to the additional
> modifier in some instances.
>
> Moving the __data_racy definition under CONFIG_KCSAN
> avoids this problem, since the volatile modifier will
> be present for both KCSAN and KCSAN_SANITIZE objects
> in a CONFIG_KCSAN=y kernel.
>
> Fixes: 31f605a308e6 ("kcsan, compiler_types: Introduce __data_racy type qualifier")
> Reported-by: Nilay Shroff <nilay@...ux.ibm.com>
> Suggested-by: Marco Elver <elver@...gle.com>
> Signed-off-by: Alan Maguire <alan.maguire@...cle.com>
Tested on gcc15 and llvm22 and all works okay. Also
the patch itself makes sense, so
Acked-by: Yonghong Song <yonghong.song@...ux.dev>
Powered by blists - more mailing lists