Skip to contentSkip to conversation

scripts: syscall: require a complete ABI name match

PATCH In review Hamdy Abou El Anein 2 participants 2 messages Nov 3 – Nov 11 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts: syscall: require a complete ABI name match

From: Hamdy Abou El Anein <[email protected]>

The --abis expression has no boundary after the ABI alternatives. Selecting common also selects common32 in a table containing both, which can include unwanted entries and inflate the syscall count.

Require whitespace after an explicitly selected ABI. Leave the default expression unchanged so that omitting --abis still selects every entry.

Tested all three generators with a synthetic table containing common, common32 and other. Single and multiple selections exclude common32, while the default includes it. Generated headers and a syscall table also compile with GCC -Wall -Wextra -Werror.

This is a selector-contract test; no current in-tree table with this particular prefix collision has been identified.

AI assistance: ChatGPT/Codex identified the issue and prepared the change, commit message and executable regression tests.

Fixes b9da928abf45 ("scripts: add generic syscallhdr.sh")
Fixes 27932b6a2088 ("scripts: add generic syscallnr.sh")
Fixes 9df526b03c01 ("scripts: add generic syscalltbl.sh")
---
 scripts/syscallhdr.sh | 2 +-
 scripts/syscallnr.sh  | 2 +-
 scripts/syscalltbl.sh | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
scripts/syscallhdr.sh +1 -1
index 22e34cd46b9..8703bd1a7c4 100755
@@ -39,7 +39,7 @@ while [ $# -gt 0 ]
 do
 	case $1 in
 	--abis)
-		abis=$(echo "($2)" | tr ',' '|')
+		abis=$(echo "($2)[[:space:]]" | tr ',' '|')
 		shift 2;;
 	--emit-nr)
 		emit_nr=1
scripts/syscallnr.sh +1 -1
index 3aa29e0dcc5..900e0c193c4 100755
@@ -34,7 +34,7 @@ while [ $# -gt 0 ]
 do
 	case $1 in
 	--abis)
-		abis=$(echo "($2)" | tr ',' '|')
+		abis=$(echo "($2)[[:space:]]" | tr ',' '|')
 		shift 2;;
 	--prefix)
 		prefix=$2
scripts/syscalltbl.sh +1 -1
index 6a903b87a7c..46c65e88481 100755
@@ -33,7 +33,7 @@ while [ $# -gt 0 ]
 do
 	case $1 in
 	--abis)
-		abis=$(echo "($2)" | tr ',' '|')
+		abis=$(echo "($2)[[:space:]]" | tr ',' '|')
 		shift 2;;
 	-*)
 		echo "$1: unknown option" >&2
#1 lore raw
Quoted 5 lines · Hamdy Abou El Anein

From: Hamdy Abou El Anein <[email protected]>

The --abis expression has no boundary after the ABI alternatives. Selecting common also selects common32 in a table containing both, which can include unwanted entries and inflate the syscall count.

These scripts are getting an overhaul and I think this bug is fixed as part of that series:

https://lore.kernel.org/[email protected]/

Signature · 2 lines
Cheers,
Nathan