mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 13:11:40 +00:00
9142be9e64
The direct-call syscall dispatch function doesn't know that the exit()
and exit_group() syscall handlers don't return, so the call sites aren't
optimized accordingly.
Fix that by marking the exit syscall declarations __noreturn.
Fixes the following warnings:
vmlinux.o: warning: objtool: x64_sys_call+0x2804: __x64_sys_exit() is missing a __noreturn annotation
vmlinux.o: warning: objtool: ia32_sys_call+0x29b6: __ia32_sys_exit_group() is missing a __noreturn annotation
Fixes: 1e3ad78334
("x86/syscall: Don't force use of indirect calls for system calls")
Closes: https://lkml.kernel.org/lkml/6dba9b32-db2c-4e6d-9500-7a08852f17a3@paulmck-laptop
Reported-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Tested-by: Paul E. McKenney <paulmck@kernel.org>
Link: https://lore.kernel.org/r/5d8882bc077d8eadcc7fd1740b56dfb781f12288.1719381528.git.jpoimboe@kernel.org
93 lines
1.8 KiB
Bash
Executable File
93 lines
1.8 KiB
Bash
Executable File
#!/bin/sh
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
|
#
|
|
# Generate a syscall table header.
|
|
#
|
|
# Each line of the syscall table should have the following format:
|
|
#
|
|
# NR ABI NAME [NATIVE] [COMPAT]
|
|
#
|
|
# NR syscall number
|
|
# ABI ABI name
|
|
# NAME syscall name
|
|
# NATIVE native entry point (optional)
|
|
# COMPAT compat entry point (optional)
|
|
|
|
set -e
|
|
|
|
usage() {
|
|
echo >&2 "usage: $0 [--abis ABIS] INFILE OUTFILE" >&2
|
|
echo >&2
|
|
echo >&2 " INFILE input syscall table"
|
|
echo >&2 " OUTFILE output header file"
|
|
echo >&2
|
|
echo >&2 "options:"
|
|
echo >&2 " --abis ABIS ABI(s) to handle (By default, all lines are handled)"
|
|
exit 1
|
|
}
|
|
|
|
# default unless specified by options
|
|
abis=
|
|
|
|
while [ $# -gt 0 ]
|
|
do
|
|
case $1 in
|
|
--abis)
|
|
abis=$(echo "($2)" | tr ',' '|')
|
|
shift 2;;
|
|
-*)
|
|
echo "$1: unknown option" >&2
|
|
usage;;
|
|
*)
|
|
break;;
|
|
esac
|
|
done
|
|
|
|
if [ $# -ne 2 ]; then
|
|
usage
|
|
fi
|
|
|
|
infile="$1"
|
|
outfile="$2"
|
|
|
|
nxt=0
|
|
|
|
grep -E "^[0-9]+[[:space:]]+$abis" "$infile" | {
|
|
|
|
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
|
|
exit 1
|
|
fi
|
|
|
|
while [ $nxt -lt $nr ]; do
|
|
echo "__SYSCALL($nxt, sys_ni_syscall)"
|
|
nxt=$((nxt + 1))
|
|
done
|
|
|
|
if [ "$compat" = "-" ]; then
|
|
unset compat
|
|
fi
|
|
|
|
if [ -n "$noreturn" ]; then
|
|
if [ "$noreturn" != "noreturn" ]; then
|
|
echo "error: $infile: invalid string \"$noreturn\" in 'noreturn' column"
|
|
exit 1
|
|
fi
|
|
if [ -n "$compat" ]; then
|
|
echo "__SYSCALL_COMPAT_NORETURN($nr, $native, $compat)"
|
|
else
|
|
echo "__SYSCALL_NORETURN($nr, $native)"
|
|
fi
|
|
elif [ -n "$compat" ]; then
|
|
echo "__SYSCALL_WITH_COMPAT($nr, $native, $compat)"
|
|
elif [ -n "$native" ]; then
|
|
echo "__SYSCALL($nr, $native)"
|
|
else
|
|
echo "__SYSCALL($nr, sys_ni_syscall)"
|
|
fi
|
|
nxt=$((nr + 1))
|
|
done
|
|
} > "$outfile"
|