From: sashiko-bot@kernel.org
To: "André Almeida" <andrealmeid@igalia.com>
Cc: "Vasily Gorbik" <gor@linux.ibm.com>,
linux-s390@vger.kernel.org,
"Christian Borntraeger" <borntraeger@linux.ibm.com>,
"Heiko Carstens" <hca@linux.ibm.com>,
"Alexander Gordeev" <agordeev@linux.ibm.com>
Subject: Re: [PATCH v6 02/13] syscalls: Create unified partial table for all archs
Date: Fri, 28 Aug 2026 23:31:07 +0000 [thread overview]
Message-ID: <20260828233108.2B4BF1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260828-tonyk-syscall_table-v6-2-fdd358456cf1@igalia.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Usage of the GNU-specific `mktemp -p` flag breaks POSIX compliance and cross-compilation on non-GNU platforms (e.g., macOS/BSD).
- [Medium] Unhandled `grep` exit status under `set -e` causes build aborts and temporary file leaks.
- [Medium] Global state overwrite in generation scripts prevents use with overlapping syscall numbering (e.g., x86_64 legacy syscalls).
--
commit 09dd7fecb9d7d6c1b19fdd2e2a3af7850e945333
Author: André Almeida <andrealmeid@igalia.com>
syscalls: Create unified partial table for all archs
To take advantage of the subset of syscall numbers that are guaranteed to
be shared, create a new table and adapt generation scripts to use it. In
that way, every new syscall can be added to a single file.
> diff --git a/scripts/syscallhdr.sh b/scripts/syscallhdr.sh
> index bad1ab606a0fb..a9b880070a3d2 100755
> --- a/scripts/syscallhdr.sh
> +++ b/scripts/syscallhdr.sh
[ ... ]
> @@ -69,13 +76,35 @@ guard=_UAPI_ASM_$(basename "$outfile" |
[ ... ]
> +max=0
> +# gen_hdr(infile)
> +gen_hdr() {
> + input=$1
> + tmpfile=$(mktemp -p .)
[Severity: High]
Does this mktemp call break the build on macOS or BSD? The -p flag is a
GNU-specific extension. On non-GNU platforms, mktemp -p is an illegal option
and fails, leaving tmpfile empty and causing a syntax error on the subsequent
redirection, which instantly halts the build.
>
> - max=0
> - while read nr abi name native compat ; do
> + grep -E "^[0-9A-Fa-fXx]+[[:space:]]+$abis" "$input" > $tmpfile
[Severity: Medium]
Since this script runs with set -e, what happens if an architecture specifies
an ABI but its local table has no matching syscalls? grep will exit with
status 1, immediately terminating the script and aborting the build. This also
bypasses the explicit rm $tmpfile command, permanently leaking temporary files
in the build directory.
> + while read nr abi name native compat; do
>
> max=$nr
[Severity: Medium]
Will this overwrite truncate __NR_syscalls when processing overlapping tables?
If a native table (like x86_64 legacy) has higher syscall numbers than the
start of syscall_common.tbl, blindly overwriting max without checking if the
new number is larger will cause __NR_syscalls to be truncated to the end of
the common table.
[ ... ]
> diff --git a/scripts/syscalltbl.sh b/scripts/syscalltbl.sh
> index c4b1f85c2dd63..f5b95b19ac92d 100755
> --- a/scripts/syscalltbl.sh
> +++ b/scripts/syscalltbl.sh
[ ... ]
> @@ -52,12 +59,16 @@ outfile="$2"
>
> nxt=0
>
> -grep -E "^[0-9]+[[:space:]]+$abis" "$infile" | {
> +# gen_tbl(infile)
> +gen_tbl() {
> + input=$1
> + tmpfile=$(mktemp -p .)
[Severity: High]
Does this mktemp call break the build on macOS or BSD? The -p flag is a
GNU-specific extension. On non-GNU platforms, mktemp -p is an illegal option
and fails, leaving tmpfile empty and causing a syntax error on the subsequent
redirection, which instantly halts the build.
>
> + grep -E "^[0-9A-Fa-fXx]+[[:space:]]+$abis" "$input" > $tmpfile
[Severity: Medium]
Since this script runs with set -e, what happens if an architecture specifies
an ABI but its local table has no matching syscalls? grep will exit with
status 1, immediately terminating the script and aborting the build. This also
bypasses the explicit rm $tmpfile command, permanently leaking temporary files
in the build directory.
> while read nr abi name native compat noreturn; do
>
> if [ $nxt -gt $nr ]; then
> - echo "error: $infile: syscall table is not sorted or duplicates the same syscall number" >&2
> + echo "error: $input: syscall table is not sorted or duplicates the same syscall number" >&2
> exit 1
> fi
[Severity: Medium]
Will this global nxt check fail for architectures with legacy syscalls? If an
architecture has local syscall numbers that are higher than the start of the
common table, appending the common table sequentially will cause nxt to be
greater than the first common syscall, triggering this not sorted error.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260828-tonyk-syscall_table-v6-0-fdd358456cf1@igalia.com?part=2
next prev parent reply other threads:[~2026-08-28 23:31 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 23:19 [PATCH v6 00/13] syscalls: Add a shared table for all archs André Almeida
2026-08-28 23:19 ` [PATCH v6 01/13] syscalls: Make --abis parsing more robust André Almeida
2026-08-28 23:32 ` sashiko-bot
2026-08-28 23:19 ` [PATCH v6 02/13] syscalls: Create unified partial table for all archs André Almeida
2026-08-28 23:31 ` sashiko-bot [this message]
2026-08-28 23:19 ` [PATCH v6 03/13] scripts/syscall.tbl: Use the common table André Almeida
2026-08-28 23:32 ` sashiko-bot
2026-08-28 23:19 ` [PATCH v6 04/13] arm: Use the common syscall table André Almeida
2026-08-28 23:35 ` sashiko-bot
2026-08-28 23:19 ` [PATCH v6 05/13] s390: " André Almeida
2026-08-28 23:27 ` sashiko-bot
2026-08-28 23:19 ` [PATCH v6 06/13] sparc: " André Almeida
2026-08-28 23:26 ` sashiko-bot
2026-08-28 23:19 ` [PATCH v6 07/13] mips: Remove duplicated syscallnr.sh André Almeida
2026-08-28 23:27 ` sashiko-bot
2026-08-28 23:19 ` [PATCH v6 08/13] mips: Get rid of custom mips ABIs for syscall tables André Almeida
2026-08-28 23:29 ` sashiko-bot
2026-08-28 23:19 ` [PATCH v6 09/13] mips: Use the common syscall table André Almeida
2026-08-28 23:35 ` sashiko-bot
2026-08-28 23:19 ` [PATCH v6 10/13] syscalls: Add an option for offsetting the common table André Almeida
2026-08-28 23:34 ` sashiko-bot
2026-08-28 23:19 ` [PATCH v6 11/13] alpha: Define entry point for set_mempolicy_home_node syscall André Almeida
2026-08-28 23:32 ` sashiko-bot
2026-08-28 23:19 ` [PATCH v6 12/13] alpha: Remove alpha_ prefix from custom syscall entries André Almeida
2026-08-28 23:35 ` sashiko-bot
2026-08-28 23:19 ` [PATCH v6 13/13] alpha: Use the common syscall table André Almeida
2026-08-28 23:39 ` 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=20260828233108.2B4BF1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=agordeev@linux.ibm.com \
--cc=andrealmeid@igalia.com \
--cc=borntraeger@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=hca@linux.ibm.com \
--cc=linux-s390@vger.kernel.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