public inbox for llvm@lists.linux.dev
 help / color / mirror / Atom feed
From: Nicolas Schier <nsc@kernel.org>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Nick Desaulniers <nick.desaulniers+lkml@gmail.com>,
	Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	Sun Jian <sun.jian.kdev@gmail.com>,
	Florian Westphal <fw@strlen.de>,
	linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org,
	llvm@lists.linux.dev
Subject: Re: [PATCH] genksyms: Fix parsing a declarator with a preceding attribute
Date: Fri, 27 Feb 2026 08:54:52 +0100	[thread overview]
Message-ID: <aaFNzDFvMI8TNrNg@derry.ads.avm.de> (raw)
In-Reply-To: <20260225-genksyms-fix-attribute-declarator-v1-1-1b21478663fb@kernel.org>

On Wed, Feb 25, 2026 at 03:07:17PM -0700, Nathan Chancellor wrote:
> After commit 07919126ecfc ("netfilter: annotate NAT helper hook pointers
> with __rcu"), genksyms fails to parse the __rcu annotation when building
> with CONFIG_DEBUG_INFO_BTF=y, CONFIG_PAHOLE_HAS_BTF_TAG=y, and a version
> of clang that supports btf_type_tag.
> 
>   $ clang --version | head -1
>   ClangBuiltLinux clang version 22.1.0 (https://github.com/llvm/llvm-project.git 4434dabb69916856b824f68a64b029c67175e532)
> 
>   $ cat kernel/configs/repro.config
>   CONFIG_BPF_SYSCALL=y
>   CONFIG_MODVERSIONS=y
>   # CONFIG_DEBUG_INFO_NONE is not set
>   CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
>   CONFIG_DEBUG_INFO_BTF=y
> 
>   $ make -skj"$(nproc)" ARCH=x86_64 LLVM=1 mrproper defconfig repro.config all
>   WARNING: modpost: EXPORT symbol "nf_nat_ftp_hook" [vmlinux] version generation failed, symbol will not be versioned.
>   ...
>   WARNING: modpost: EXPORT symbol "nf_nat_irc_hook" [vmlinux] version generation failed, symbol will not be versioned.
>   ...
> 
> genksyms falls over parsing the __rcu attribute in the declarator:
> 
>   # Kernel reproducer
>   $ make -skj"$(nproc)" ARCH=x86_64 KCFLAGS=-D__GENKSYMS__ LLVM=1 net/netfilter/nf_conntrack_ftp.i
> 
>   $ scripts/genksyms/genksyms -w <net/netfilter/nf_conntrack_ftp.i &| rg 'syntax error'
>   include/linux/netfilter/nf_conntrack_ftp.h:29: syntax error
>   net/netfilter/nf_conntrack_ftp.c:46: syntax error
> 
>   # Trivial reproducer
>   $ cat test.c
>   int (*func)(void *foo, int bar);
>   int (__attribute__((btf_type_tag("rcu"))) *func_with_attr)(void *foo, int bar);
> 
>   $ scripts/genksyms/genksyms -w <test.c
>   <stdin>:2: syntax error
> 
> Optionally allow an attribute to precede a declarator to resolve this
> error and properly generate symbol versions.
> 
> Fixes: 07919126ecfc ("netfilter: annotate NAT helper hook pointers with __rcu")
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>
> ---
> I plan to take this via the Kbuild tree for 7.0.
> ---
>  scripts/genksyms/parse.y | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 

Thanks for the detailed explanation and reproducer!

Tested-by: Nicolas Schier <nsc@kernel.org>
Reviewed-by: Nicolas Schier <nsc@kernel.org>

  parent reply	other threads:[~2026-02-27  8:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25 22:07 [PATCH] genksyms: Fix parsing a declarator with a preceding attribute Nathan Chancellor
2026-02-26  4:36 ` sun jian
2026-02-26 20:26   ` Nathan Chancellor
2026-02-27  7:54 ` Nicolas Schier [this message]
2026-03-05  0:36 ` Nathan Chancellor

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=aaFNzDFvMI8TNrNg@derry.ads.avm.de \
    --to=nsc@kernel.org \
    --cc=fw@strlen.de \
    --cc=justinstitt@google.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=nick.desaulniers+lkml@gmail.com \
    --cc=sun.jian.kdev@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