* [PATCH] kbuild: check duplicated syscall number in syscall table
@ 2021-07-05 6:06 Masahiro Yamada
0 siblings, 0 replies; only message in thread
From: Masahiro Yamada @ 2021-07-05 6:06 UTC (permalink / raw)
To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel
Currently, syscall{hdr,tbl}.sh sorts the entire syscall table, but you
can assume it is already sorted by the syscall number.
The generated syscall table does not work if the same syscall number
appers twice. Check it in the script.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/syscallhdr.sh | 2 +-
scripts/syscalltbl.sh | 7 ++++++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/scripts/syscallhdr.sh b/scripts/syscallhdr.sh
index 848ac2735115..22e34cd46b9b 100755
--- a/scripts/syscallhdr.sh
+++ b/scripts/syscallhdr.sh
@@ -69,7 +69,7 @@ guard=_UAPI_ASM_$(basename "$outfile" |
sed -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
-e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g')
-grep -E "^[0-9A-Fa-fXx]+[[:space:]]+$abis" "$infile" | sort -n | {
+grep -E "^[0-9A-Fa-fXx]+[[:space:]]+$abis" "$infile" | {
echo "#ifndef $guard"
echo "#define $guard"
echo
diff --git a/scripts/syscalltbl.sh b/scripts/syscalltbl.sh
index aa6ab156301c..6abe143889ef 100755
--- a/scripts/syscalltbl.sh
+++ b/scripts/syscalltbl.sh
@@ -52,10 +52,15 @@ outfile="$2"
nxt=0
-grep -E "^[0-9]+[[:space:]]+$abis" "$infile" | sort -n | {
+grep -E "^[0-9]+[[:space:]]+$abis" "$infile" | {
while read nr abi name native compat ; do
+ if [ $nxt -gt $nr ]; then
+ echo "error: $infile: syscall table is not sorted or duplicates the same syscall number" >&2
+ exit 1
+ fi
+
while [ $nxt -lt $nr ]; do
echo "__SYSCALL($nxt, sys_ni_syscall)"
nxt=$((nxt + 1))
--
2.27.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-07-05 6:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-05 6:06 [PATCH] kbuild: check duplicated syscall number in syscall table Masahiro Yamada
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®