From: sashiko-bot@kernel.org
To: "André Almeida" <andrealmeid@igalia.com>,
"Masami Hiramatsu" <mhiramat@kernel.org>,
"Arnd Bergmanon" <arnd@arndb.de>
Cc: "Christian Brauner" <brauner@kernel.org>,
linux-kbuild@vger.kernel.org, kernel-dev@igalia.com,
"Thomas Bogendoerfer" <tsbogend@alpha.franken.de>,
linux-s390@vger.kernel.org, sparclinux@vger.kernel.org,
nathan@kernel.org, nsc@kernel.org,
"Heiko Carstens" <hca@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>,
"Christian Borntraeger" <borntraeger@linux.ibm.com>
Subject: Re: [PATCH v9 13/15] syscalls: Avoid matching substrings in the ABI parsing
Date: Fri, 06 Nov 2026 20:33:44 +0000 [thread overview]
Message-ID: <sashiko-outbox-202226@kernel.org> (raw)
In-Reply-To: <20261105-tonyk-syscall_table-v9-13-8d1275885d9c@igalia.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] syscalls: gen_hdr() and gen_tbl() regex breaks empty --abis and
repeats $abis
--
commit a315ea4d793f1941d3f493720c8515e41d764ee1
Author: André Almeida <andrealmeid@igalia.com>
syscalls: Avoid matching substrings in the ABI parsing
This commit updates the grep regular expressions in scripts/syscallhdr.sh
and scripts/syscalltbl.sh to require trailing whitespace after the ABI
pattern so that ABI names do not match as substrings, and appends "|| true"
to prevent the scripts from exiting early when grep finds no matches.
> diff --git a/scripts/syscallhdr.sh b/scripts/syscallhdr.sh
> index cf6bba3019b12..cf35ff05b8242 100755
> --- a/scripts/syscallhdr.sh
> +++ b/scripts/syscallhdr.sh
> @@ -109,7 +109,7 @@ gen_hdr() {
> tmpfile=$(mktemp)
> offset_nr=$2
>
> - grep -E "^[0-9A-Fa-fXx]+[[:space:]]+$abis" "$input" > $tmpfile
> + grep -E "^[0-9A-Fa-fXx]+[[:space:]]+$abis+[[:space:]]" "$input" > $tmpfile || true
> while read nr abi name native compat; do
>
> if [ -n "$offset_nr" ]; then
> diff --git a/scripts/syscalltbl.sh b/scripts/syscalltbl.sh
> index 1e9cac32c02d2..403a604e7c760 100755
> --- a/scripts/syscalltbl.sh
> +++ b/scripts/syscalltbl.sh
> @@ -70,7 +70,7 @@ gen_tbl() {
> tmpfile=$(mktemp)
> offset_nr=$2
>
> - grep -E "^[0-9A-Fa-fXx]+[[:space:]]+$abis" "$input" > $tmpfile
> + grep -E "^[0-9A-Fa-fXx]+[[:space:]]+$abis+[[:space:]]" "$input" > $tmpfile || true
[Severity: High]
What happens in gen_hdr() in scripts/syscallhdr.sh and gen_tbl() in
scripts/syscalltbl.sh when --abis is not passed on the command line?
Both scripts initialize abis to an empty string by default when --abis is
omitted:
# default unless specified by options
abis=
Architectures such as m68k, microblaze, sh, and xtensa invoke syscallhdr.sh
and syscalltbl.sh without --abis, for example in
arch/m68k/kernel/syscalls/Makefile:
cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --emit-nr $< $@
quiet_cmd_systbl = SYSTBL $@
cmd_systbl = $(CONFIG_SHELL) $(systbl) $< $@
When abis is empty, the pattern in gen_hdr() and gen_tbl() expands to:
^[0-9A-Fa-fXx]+[[:space:]]++[[:space:]]
Because there is no subpattern to match the ABI column (such as common) and
the syscall number is separated from the ABI name by a single tab character,
grep matches zero lines (or rejects ++ as an invalid ERE repetition). With
"|| true" suppressing the non-zero exit status from grep, wouldn't gen_hdr()
and gen_tbl() read an empty tmpfile and silently generate empty syscall
headers and syscall tables for those architectures?
Also, when --abis is specified, the option parser constructs a parenthesized
group:
--abis)
abis="($(echo "${2%,}" | tr ',' '|'))"
Writing "$abis+[[:space:]]" places the "+" quantifier on the "$abis" group
rather than on "[[:space:]]", expanding to "(abc)+[[:space:]]" or
"(common|64)+[[:space:]]", which matches repeated or concatenated ABI names
such as "abcabc" or "common64".
Should abis instead default to a pattern that matches any non-whitespace
token (such as "[^[:space:]]+"), or should the "[[:space:]]+" suffix be
included inside abis only when --abis is set?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261105-tonyk-syscall_table-v9-0-8d1275885d9c@igalia.com?part=13
next prev parent reply other threads:[~2026-11-06 20:33 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 20:05 [PATCH v9 00/15] syscalls: Add a shared table for all archs André Almeida
2026-11-05 20:05 ` [PATCH v9 01/15] syscalls: Make --abis parsing more robust André Almeida
2026-11-05 20:05 ` [PATCH v9 02/15] syscalls: Create unified partial table for all archs André Almeida
2026-11-05 20:05 ` [PATCH v9 03/15] scripts/syscall.tbl: Use the common table André Almeida
2026-11-06 20:33 ` sashiko-bot
2026-11-05 20:05 ` [PATCH v9 04/15] s390: Use the common syscall table André Almeida
2026-11-05 20:05 ` [PATCH v9 05/15] sparc: " André Almeida
2026-11-05 20:05 ` [PATCH v9 06/15] mips: Remove duplicated syscallnr.sh André Almeida
2026-11-05 20:05 ` [PATCH v9 07/15] mips: Get rid of custom mips ABIs for syscall tables André Almeida
2026-11-05 20:05 ` [PATCH v9 08/15] mips: Use the common syscall table André Almeida
2026-11-05 20:05 ` [PATCH v9 09/15] syscalls: Add an option for offsetting the common table André Almeida
2026-11-05 20:05 ` [PATCH v9 10/15] alpha: Define entry point for set_mempolicy_home_node syscall André Almeida
2026-11-11 7:40 ` Magnus Lindholm
2026-11-05 20:05 ` [PATCH v9 11/15] alpha: Remove alpha_ prefix from custom syscall entries André Almeida
2026-11-06 20:33 ` sashiko-bot
2026-11-11 7:43 ` Magnus Lindholm
2026-11-05 20:05 ` [PATCH v9 12/15] alpha: Use the common syscall table André Almeida
2026-11-11 7:51 ` Magnus Lindholm
2026-11-05 20:05 ` [PATCH v9 13/15] syscalls: Avoid matching substrings in the ABI parsing André Almeida
2026-11-06 20:33 ` sashiko-bot [this message]
2026-11-05 20:05 ` [PATCH v9 14/15] arm: Reorganize syscall table and separated the ABIs André Almeida
2026-11-06 20:33 ` sashiko-bot
2026-11-05 20:05 ` [PATCH v9 15/15] arm: Use common syscall table André Almeida
2026-11-06 20:33 ` sashiko-bot
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-202226@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=andrealmeid@igalia.com \
--cc=arnd@arndb.de \
--cc=borntraeger@linux.ibm.com \
--cc=brauner@kernel.org \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=kernel-dev@igalia.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=sparclinux@vger.kernel.org \
--cc=tsbogend@alpha.franken.de \
/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