Commit cfcbadb4 authored by Andy Lutomirski's avatar Andy Lutomirski Committed by Ingo Molnar

x86/syscalls: Add syscall entry qualifiers

This will let us specify something like 'sys_xyz/foo' instead of
'sys_xyz' in the syscall table, where the 'foo' qualifier conveys
some extra information to the C code.

The intent is to allow things like sys_execve/ptregs to indicate
that sys_execve() touches pt_regs.
Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/2de06e33dce62556b3ec662006fcb295504e296e.1454022279.git.luto@kernel.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 3e65654e
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
#include <asm/asm-offsets.h> #include <asm/asm-offsets.h>
#include <asm/syscall.h> #include <asm/syscall.h>
#define __SYSCALL_I386(nr, sym) extern asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) ; #define __SYSCALL_I386(nr, sym, qual) extern asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) ;
#include <asm/syscalls_32.h> #include <asm/syscalls_32.h>
#undef __SYSCALL_I386 #undef __SYSCALL_I386
#define __SYSCALL_I386(nr, sym) [nr] = sym, #define __SYSCALL_I386(nr, sym, qual) [nr] = sym,
extern asmlinkage long sys_ni_syscall(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long); extern asmlinkage long sys_ni_syscall(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
......
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
#include <asm/asm-offsets.h> #include <asm/asm-offsets.h>
#include <asm/syscall.h> #include <asm/syscall.h>
#define __SYSCALL_64(nr, sym) extern asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) ; #define __SYSCALL_64(nr, sym, qual) extern asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) ;
#include <asm/syscalls_64.h> #include <asm/syscalls_64.h>
#undef __SYSCALL_64 #undef __SYSCALL_64
#define __SYSCALL_64(nr, sym) [nr] = sym, #define __SYSCALL_64(nr, sym, qual) [nr] = sym,
extern long sys_ni_syscall(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long); extern long sys_ni_syscall(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
......
...@@ -3,6 +3,19 @@ ...@@ -3,6 +3,19 @@
in="$1" in="$1"
out="$2" out="$2"
syscall_macro() {
abi="$1"
nr="$2"
entry="$3"
# Entry can be either just a function name or "function/qualifier"
real_entry="${entry%%/*}"
qualifier="${entry:${#real_entry}}" # Strip the function name
qualifier="${qualifier:1}" # Strip the slash, if any
echo "__SYSCALL_${abi}($nr, $real_entry, $qualifier)"
}
emit() { emit() {
abi="$1" abi="$1"
nr="$2" nr="$2"
...@@ -16,15 +29,15 @@ emit() { ...@@ -16,15 +29,15 @@ emit() {
if [ -z "$compat" ]; then if [ -z "$compat" ]; then
if [ -n "$entry" ]; then if [ -n "$entry" ]; then
echo "__SYSCALL_${abi}($nr, $entry)" syscall_macro "$abi" "$nr" "$entry"
fi fi
else else
echo "#ifdef CONFIG_X86_32" echo "#ifdef CONFIG_X86_32"
if [ -n "$entry" ]; then if [ -n "$entry" ]; then
echo "__SYSCALL_${abi}($nr, $entry)" syscall_macro "$abi" "$nr" "$entry"
fi fi
echo "#else" echo "#else"
echo "__SYSCALL_${abi}($nr, $compat)" syscall_macro "$abi" "$nr" "$compat"
echo "#endif" echo "#endif"
fi fi
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include <linux/lguest.h> #include <linux/lguest.h>
#include "../../../drivers/lguest/lg.h" #include "../../../drivers/lguest/lg.h"
#define __SYSCALL_I386(nr, sym) [nr] = 1, #define __SYSCALL_I386(nr, sym, qual) [nr] = 1,
static char syscalls[] = { static char syscalls[] = {
#include <asm/syscalls_32.h> #include <asm/syscalls_32.h>
}; };
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
#include <asm/ia32.h> #include <asm/ia32.h>
#define __SYSCALL_64(nr, sym) [nr] = 1, #define __SYSCALL_64(nr, sym, qual) [nr] = 1,
static char syscalls_64[] = { static char syscalls_64[] = {
#include <asm/syscalls_64.h> #include <asm/syscalls_64.h>
}; };
#define __SYSCALL_I386(nr, sym) [nr] = 1, #define __SYSCALL_I386(nr, sym, qual) [nr] = 1,
static char syscalls_ia32[] = { static char syscalls_ia32[] = {
#include <asm/syscalls_32.h> #include <asm/syscalls_32.h>
}; };
......
...@@ -25,11 +25,11 @@ ...@@ -25,11 +25,11 @@
#define old_mmap sys_old_mmap #define old_mmap sys_old_mmap
#define __SYSCALL_I386(nr, sym) extern asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) ; #define __SYSCALL_I386(nr, sym, qual) extern asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) ;
#include <asm/syscalls_32.h> #include <asm/syscalls_32.h>
#undef __SYSCALL_I386 #undef __SYSCALL_I386
#define __SYSCALL_I386(nr, sym) [ nr ] = sym, #define __SYSCALL_I386(nr, sym, qual) [ nr ] = sym,
extern asmlinkage long sys_ni_syscall(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long); extern asmlinkage long sys_ni_syscall(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
......
...@@ -35,11 +35,11 @@ ...@@ -35,11 +35,11 @@
#define stub_execveat sys_execveat #define stub_execveat sys_execveat
#define stub_rt_sigreturn sys_rt_sigreturn #define stub_rt_sigreturn sys_rt_sigreturn
#define __SYSCALL_64(nr, sym) extern asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) ; #define __SYSCALL_64(nr, sym, qual) extern asmlinkage long sym(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long) ;
#include <asm/syscalls_64.h> #include <asm/syscalls_64.h>
#undef __SYSCALL_64 #undef __SYSCALL_64
#define __SYSCALL_64(nr, sym) [ nr ] = sym, #define __SYSCALL_64(nr, sym, qual) [ nr ] = sym,
extern asmlinkage long sys_ni_syscall(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long); extern asmlinkage long sys_ni_syscall(unsigned long, unsigned long, unsigned long, unsigned long, unsigned long, unsigned long);
......
...@@ -9,12 +9,12 @@ ...@@ -9,12 +9,12 @@
#include <asm/types.h> #include <asm/types.h>
#ifdef __i386__ #ifdef __i386__
#define __SYSCALL_I386(nr, sym) [nr] = 1, #define __SYSCALL_I386(nr, sym, qual) [nr] = 1,
static char syscalls[] = { static char syscalls[] = {
#include <asm/syscalls_32.h> #include <asm/syscalls_32.h>
}; };
#else #else
#define __SYSCALL_64(nr, sym) [nr] = 1, #define __SYSCALL_64(nr, sym, qual) [nr] = 1,
static char syscalls[] = { static char syscalls[] = {
#include <asm/syscalls_64.h> #include <asm/syscalls_64.h>
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment