Linux kbuild/kconfig development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Leizhen Zhang" <lzsx618@gmail.com>, nathan@kernel.org, nsc@kernel.org
Cc: masahiroy@kernel.org, ardb@kernel.org, rostedt@goodmis.org,
	hpa@zytor.com, linux-kbuild@vger.kernel.org
Subject: Re: [PATCH v3 1/6] genksyms: fix infinite loop on declarations with parameter lists
Date: Wed, 11 Nov 2026 00:01:14 +0000	[thread overview]
Message-ID: <sashiko-outbox-207990@kernel.org> (raw)
In-Reply-To: <20261110000003.1719966-2-lzsx618@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] genksyms: unresolvable ambiguous 12-char SHA in Fixes trailer
--

commit e896d8ddfccae8b5749722baf42845ecf75f09be
Author: Leizhen Zhang <lzsx618@gmail.com>

> genksyms: fix infinite loop on declarations with parameter lists
>
> decl_specifier_seq updates the global decl_spec, which is used by the ','
> action of init_declarator_list to give each further declarator the
> specifiers of the declaration. However, decl_specifier_seq is also used
> for parameter declarations, so for a declaration such as
>
>   int a, f(int);
>
> decl_spec is clobbered by the specifiers of the parameter "int" by the
> time the ',' action runs. The action then links the parameter's own token
> node back into its chain, creating a cycle, and copy_list_range() loops
> forever while allocating memory:
>
>   $ printf 'int a, f(int);\n' | scripts/genksyms/genksyms
>   (hangs)
>
> Before commit 45c9c4101d3d ("genksyms: fix memory leak when the same
> symbol is added from source") the same corruption did not hang but
> silently recorded a wrong type for subsequent declarators (e.g. for
> "int f(long), a;" the type of "a" was recorded as "int f ( long a").
>
> Only set decl_spec in decl_specifier_seq_opt, which is used at the
> declaration level, and let decl_specifier_seq just return the last
> specifier. Struct and union member declarations use a new
> member_decl_specifier_seq_opt that does not touch decl_spec, so a
> struct body nested in a parameter list cannot clobber it either.
>
> The generated symtypes and CRCs for 149 preprocessed kernel source files
> (1128 exported symbols) are unchanged, and no new bison conflicts are
> introduced.
>
> Found by fuzzing genksyms with ASan/UBSan.
>
> The problem was found with ASan and UBSan, and the analysis and fix were
> prepared with the help of an AI coding assistant; I reviewed and
> tested the result.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Leizhen Zhang <lzsx618@gmail.com>

[Severity: Low]
In the kernel repository, the 12-character prefix 1da177e4c3f4 is ambiguous
because it matches both 1da177e4c3f41 ("Linux-2.6.12-rc2") and
1da177e4c3f47 ("docs: git SHA prefixes are for humans"), so git cannot
resolve the Fixes tag.  Should this use at least 13 characters, or
reference 45c9c4101d3d ("genksyms: fix memory leak when the same symbol is
added from source") which introduced the copy_list_range() call that loops
forever?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261110000003.1719966-1-lzsx618@gmail.com?part=1

  reply	other threads:[~2026-11-11  0:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 23:59 [PATCH v3 0/6] kbuild: fix UB hit by normal builds in host tools Leizhen Zhang
2026-11-09 23:59 ` [PATCH v3 1/6] genksyms: fix infinite loop on declarations with parameter lists Leizhen Zhang
2026-11-11  0:01   ` sashiko-bot [this message]
2026-11-09 23:59 ` [PATCH v3 2/6] kallsyms: do not call qsort() with a NULL table Leizhen Zhang
2026-11-10  0:00 ` [PATCH v3 3/6] modpost: fix handling of short reads in read_text_file() Leizhen Zhang
2026-11-10  0:00 ` [PATCH v3 4/6] modpost: fix pointer arithmetic on NULL in parse_source_files() Leizhen Zhang
2026-11-10  0:00 ` [PATCH v3 5/6] sorttable: avoid pointer arithmetic overflow when locating sort_needed Leizhen Zhang
2026-11-10  0:00 ` [PATCH v3 6/6] tools/include: fix signed shift overflow in 32-bit unaligned accessors Leizhen Zhang

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=sashiko-outbox-207990@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=ardb@kernel.org \
    --cc=hpa@zytor.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=lzsx618@gmail.com \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nsc@kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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