BPF List
 help / color / mirror / Atom feed
From: Yonghong Song <yonghong.song@linux.dev>
To: Alan Maguire <alan.maguire@oracle.com>,
	kees@kernel.org, nathan@kernel.org, peterz@infradead.org,
	elver@google.com
Cc: ojeda@kernel.org, akpm@linux-foundation.org, ubizjak@gmail.com,
	Jason@zx2c4.com, Marc.Herbert@linux.intel.com, hca@linux.ibm.com,
	hpa@zytor.com, namjain@linux.microsoft.com, paulmck@kernel.org,
	linux-kernel@vger.kernel.org, andrii.nakryiko@gmail.com,
	ast@kernel.org, jolsa@kernel.org, daniel@iogearbox.net,
	martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org,
	john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me,
	haoluo@google.com, bvanassche@acm.org, nilay@linux.ibm.com,
	bpf@vger.kernel.org
Subject: Re: [PATCH] kcsan, compiler_types: avoid duplicate type issues in BPF Type Format
Date: Fri, 16 Jan 2026 09:26:49 -0800	[thread overview]
Message-ID: <8131f46b-7115-44db-b182-9471afa67e61@linux.dev> (raw)
In-Reply-To: <20260116091730.324322-1-alan.maguire@oracle.com>



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@linux.ibm.com>
> Suggested-by: Marco Elver <elver@google.com>
> Signed-off-by: Alan Maguire <alan.maguire@oracle.com>

Tested on gcc15 and llvm22 and all works okay. Also
the patch itself makes sense, so

Acked-by: Yonghong Song <yonghong.song@linux.dev>



      parent reply	other threads:[~2026-01-16 17:27 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-16  9:17 [PATCH] kcsan, compiler_types: avoid duplicate type issues in BPF Type Format Alan Maguire
2026-01-16 10:13 ` Marco Elver
2026-01-27 23:08   ` Marco Elver
2026-01-27 23:31     ` Andrew Morton
2026-01-28  0:02       ` Alexei Starovoitov
2026-01-28  1:04         ` Andrew Morton
2026-01-28  1:44       ` Marco Elver
2026-01-16 13:15 ` Nilay Shroff
2026-01-16 17:26 ` Yonghong Song [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8131f46b-7115-44db-b182-9471afa67e61@linux.dev \
    --to=yonghong.song@linux.dev \
    --cc=Jason@zx2c4.com \
    --cc=Marc.Herbert@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan.maguire@oracle.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=bvanassche@acm.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=elver@google.com \
    --cc=haoluo@google.com \
    --cc=hca@linux.ibm.com \
    --cc=hpa@zytor.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kees@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=namjain@linux.microsoft.com \
    --cc=nathan@kernel.org \
    --cc=nilay@linux.ibm.com \
    --cc=ojeda@kernel.org \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=sdf@fomichev.me \
    --cc=song@kernel.org \
    --cc=ubizjak@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox