x86: hook up execveat system call
authorDavid Drysdale <drysdale@google.com>
Sat, 13 Dec 2014 00:57:33 +0000 (16:57 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 13 Dec 2014 20:42:51 +0000 (12:42 -0800)
Hook up x86-64, i386 and x32 ABIs.

Signed-off-by: David Drysdale <drysdale@google.com>
Cc: Meredydd Luff <meredydd@senatehouse.org>
Cc: Shuah Khan <shuah.kh@samsung.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Rich Felker <dalias@aerifal.cx>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/x86/ia32/audit.c
arch/x86/ia32/ia32entry.S
arch/x86/kernel/audit_64.c
arch/x86/kernel/entry_64.S
arch/x86/syscalls/syscall_32.tbl
arch/x86/syscalls/syscall_64.tbl
arch/x86/um/sys_call_table_64.c

index 5d7b381da692e082ae4edb75a71e8a4c009bdb34..2eccc8932ae6f9229296d74c09503ebc2714432f 100644 (file)
@@ -35,6 +35,7 @@ int ia32_classify_syscall(unsigned syscall)
        case __NR_socketcall:
                return 4;
        case __NR_execve:
+       case __NR_execveat:
                return 5;
        default:
                return 1;
index ffe71228fc10c3080795c576b1ffae6b62160d7f..82e8a1d446583efaa5a3c0426887d3a47abc5ddd 100644 (file)
@@ -480,6 +480,7 @@ GLOBAL(\label)
        PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn
        PTREGSCALL stub32_sigreturn, sys32_sigreturn
        PTREGSCALL stub32_execve, compat_sys_execve
+       PTREGSCALL stub32_execveat, compat_sys_execveat
        PTREGSCALL stub32_fork, sys_fork
        PTREGSCALL stub32_vfork, sys_vfork
 
index 06d3e5a14d9dd70e2f709cef205c269f0a514203..f3672508b2491b385dddbe83c864c455eccba4b0 100644 (file)
@@ -50,6 +50,7 @@ int audit_classify_syscall(int abi, unsigned syscall)
        case __NR_openat:
                return 3;
        case __NR_execve:
+       case __NR_execveat:
                return 5;
        default:
                return 0;
index c0226ab541061870bb590a9c817d0770e618697c..90878aa38dbd7fac20bb42386248f1d860f26ff1 100644 (file)
@@ -652,6 +652,20 @@ ENTRY(stub_execve)
        CFI_ENDPROC
 END(stub_execve)
 
+ENTRY(stub_execveat)
+       CFI_STARTPROC
+       addq $8, %rsp
+       PARTIAL_FRAME 0
+       SAVE_REST
+       FIXUP_TOP_OF_STACK %r11
+       call sys_execveat
+       RESTORE_TOP_OF_STACK %r11
+       movq %rax,RAX(%rsp)
+       RESTORE_REST
+       jmp int_ret_from_sys_call
+       CFI_ENDPROC
+END(stub_execveat)
+
 /*
  * sigreturn is special because it needs to restore all registers on return.
  * This cannot be done with SYSRET, so use the IRET return path instead.
@@ -697,6 +711,20 @@ ENTRY(stub_x32_execve)
        CFI_ENDPROC
 END(stub_x32_execve)
 
+ENTRY(stub_x32_execveat)
+       CFI_STARTPROC
+       addq $8, %rsp
+       PARTIAL_FRAME 0
+       SAVE_REST
+       FIXUP_TOP_OF_STACK %r11
+       call compat_sys_execveat
+       RESTORE_TOP_OF_STACK %r11
+       movq %rax,RAX(%rsp)
+       RESTORE_REST
+       jmp int_ret_from_sys_call
+       CFI_ENDPROC
+END(stub_x32_execveat)
+
 #endif
 
 /*
index 9fe1b5d002f0ad5a30039ba672c85dbbf1c3ca38..b3560ece1c9fbae0ff05c14824b76a07efdb0776 100644 (file)
 355    i386    getrandom               sys_getrandom
 356    i386    memfd_create            sys_memfd_create
 357    i386    bpf                     sys_bpf
+358    i386    execveat                sys_execveat                    stub32_execveat
index 281150b539a2fb8eb802816612e768cf25dc9990..8d656fbb57aab2606132858d48b2db7e99e8bf7c 100644 (file)
 319    common  memfd_create            sys_memfd_create
 320    common  kexec_file_load         sys_kexec_file_load
 321    common  bpf                     sys_bpf
+322    64      execveat                stub_execveat
 
 #
 # x32-specific system call numbers start at 512 to avoid cache impact
 542    x32     getsockopt              compat_sys_getsockopt
 543    x32     io_setup                compat_sys_io_setup
 544    x32     io_submit               compat_sys_io_submit
+545    x32     execveat                stub_x32_execveat
index f2f0723070caea848a88fe1f96863943fc3df121..20c3649d06915cce37ea62b5ee8c9a6d704c0a62 100644 (file)
@@ -31,6 +31,7 @@
 #define stub_fork sys_fork
 #define stub_vfork sys_vfork
 #define stub_execve sys_execve
+#define stub_execveat sys_execveat
 #define stub_rt_sigreturn sys_rt_sigreturn
 
 #define __SYSCALL_COMMON(nr, sym, compat) __SYSCALL_64(nr, sym, compat)