All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "André Almeida" <andrealmeid@igalia.com>
Cc: linux-s390@vger.kernel.org,
	"Christian Borntraeger" <borntraeger@linux.ibm.vom>,
	"Alexander Gordeev" <agordeev@linux.ibm.com>,
	"Vasily Gorbik" <gor@linux.ibm.com>,
	"Heiko Carstens" <hca@linux.ibm.com>
Subject: Re: [PATCH v5 13/13] alpha: Use the common syscall table
Date: Wed, 12 Aug 2026 18:01:48 +0000	[thread overview]
Message-ID: <20260812180148.B7E4F1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260812-tonyk-syscall_table-v5-13-3d383927c609@igalia.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Critical] Incorrect `__NR_syscalls` calculation in `syscallhdr.sh` truncates the syscall table bounds check on Alpha, breaking all syscalls >= 472.
- [Low] The modified syscall build scripts use Bash-specific process substitution, which causes syntax errors and build failures on systems where /bin/sh is dash.
--

--- Patch [13]: [PATCH v5 13/13] alpha: Use the common syscall table ---
commit 8a4799a8727ec390bf08ab1390ac21a27d092616
Author: André Almeida <andrealmeid@igalia.com>

    alpha: Use the common syscall table
    
    Remove some of the duplicated code by using the common syscall number
    table.

> diff --git a/arch/alpha/kernel/syscalls/Makefile b/arch/alpha/kernel/syscalls/Makefile
> index b265e4bc16c2e..18682418327bc 100644
> --- a/arch/alpha/kernel/syscalls/Makefile
> +++ b/arch/alpha/kernel/syscalls/Makefile
> @@ -7,12 +7,18 @@ $(shell mkdir -p $(uapi) $(kapi))
>  syscall := $(src)/syscall.tbl
>  syshdr := $(srctree)/scripts/syscallhdr.sh
>  systbl := $(srctree)/scripts/syscalltbl.sh
> +systbl_common := $(srctree)/scripts/syscall_common.tbl
> +abis := common,__clone3
>  
>  quiet_cmd_syshdr = SYSHDR  $@
> -      cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --emit-nr $< $@
> +      cmd_syshdr = $(CONFIG_SHELL) $(syshdr) --emit-nr \
> +		   --common-tbl $(systbl_common) --common-offset 110 \
> +		   --abis $(abis) $< $@

[Severity: Critical]
Does this offset argument truncate the syscall table bounds check on Alpha?

When the common table is processed via scripts/syscallhdr.sh, the maximum
syscall number is stored before applying the offset:

scripts/syscallhdr.sh:gen_hdr() {
    ...
    while read nr abi name native compat; do
        max=$nr

        if [ -n "$offset_nr" ]; then
            nr=$((nr + offset_nr))
        fi
    ...
}

Because max is assigned the un-offset number, it resets to 471 when parsing
the common table, instead of reflecting Alpha's actual maximum (581). This
causes __NR_syscalls to be emitted as 472.

Consequently, does this cause the bounds check in arch/alpha/kernel/entry.S
(entSys) to reject all valid syscalls >= 472 with -ENOSYS? This would break
several valid syscalls when using the offset.

>  
>  quiet_cmd_systbl = SYSTBL  $@
> -      cmd_systbl = $(CONFIG_SHELL) $(systbl) $< $@
> +      cmd_systbl = $(CONFIG_SHELL) $(systbl) \
> +		   --common-tbl $(systbl_common) --common-offset 110 \
> +		   --abis $(abis) $< $@

[Severity: Low]
Do these modified build commands fail on systems where /bin/sh is dash?

Both scripts/syscallhdr.sh and scripts/syscalltbl.sh use a bash-specific
process substitution pattern:

scripts/syscallhdr.sh:gen_hdr() {
    ...
    done < <(grep -E "^[0-9A-Fa-fXx]+[[:space:]]+$abis" "$input")
}

scripts/syscalltbl.sh:gen_tbl() {
    ...
    done < <(grep -E "^[0-9]+[[:space:]]+$abis" "$input")
}

This syntax is a bash extension and results in syntax errors on strictly
POSIX-compliant shells like dash, causing the build to fail.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260812-tonyk-syscall_table-v5-0-3d383927c609@igalia.com?part=13

      reply	other threads:[~2026-08-12 18:01 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12 17:38 [PATCH v5 00/13] syscalls: Add a shared table for all archs André Almeida
2026-08-12 17:38 ` [PATCH v5 01/13] syscalls: Make --abis parsing more robust André Almeida
2026-08-12 17:50   ` sashiko-bot
2026-08-12 17:38 ` [PATCH v5 02/13] syscalls: Create unified partial table for all archs André Almeida
2026-08-12 17:49   ` sashiko-bot
2026-08-12 17:38 ` [PATCH v5 03/13] scripts/syscall.tbl: Use the common table André Almeida
2026-08-12 17:53   ` sashiko-bot
2026-08-12 17:38 ` [PATCH v5 04/13] arm: Use the common syscall table André Almeida
2026-08-12 18:10   ` sashiko-bot
2026-08-12 17:38 ` [PATCH v5 05/13] s390: " André Almeida
2026-08-12 17:50   ` sashiko-bot
2026-08-12 17:38 ` [PATCH v5 06/13] sparc: " André Almeida
2026-08-12 17:48   ` sashiko-bot
2026-08-12 17:38 ` [PATCH v5 07/13] mips: Remove duplicated syscallnr.sh André Almeida
2026-08-12 17:48   ` sashiko-bot
2026-08-12 17:38 ` [PATCH v5 08/13] mips: Get rid of custom mips ABIs for syscall tables André Almeida
2026-08-12 17:49   ` sashiko-bot
2026-08-12 17:38 ` [PATCH v5 09/13] mips: Use the common syscall table André Almeida
2026-08-12 17:53   ` sashiko-bot
2026-08-12 17:38 ` [PATCH v5 10/13] syscalls: Add an option for offsetting the common table André Almeida
2026-08-12 17:56   ` sashiko-bot
2026-08-12 17:38 ` [PATCH v5 11/13] alpha: Define entry point for set_mempolicy_home_node syscall André Almeida
2026-08-12 17:57   ` sashiko-bot
2026-08-12 17:38 ` [PATCH v5 12/13] alpha: Remove alpha_ prefix from custom syscall entries André Almeida
2026-08-12 17:58   ` sashiko-bot
2026-08-12 17:38 ` [PATCH v5 13/13] alpha: Use the common syscall table André Almeida
2026-08-12 18:01   ` sashiko-bot [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=20260812180148.B7E4F1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=andrealmeid@igalia.com \
    --cc=borntraeger@linux.ibm.vom \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.