Commit 27d6ec7a authored by David Drysdale's avatar David Drysdale Committed by Linus Torvalds
Browse files

x86: hook up execveat system call



Hook up x86-64, i386 and x32 ABIs.

Signed-off-by: default avatarDavid 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 51f39a1f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;
+1 −0
Original line number Diff line number Diff line
@@ -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

+1 −0
Original line number Diff line number Diff line
@@ -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;
+28 −0
Original line number Diff line number Diff line
@@ -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

/*
+1 −0
Original line number Diff line number Diff line
@@ -364,3 +364,4 @@
355	i386	getrandom		sys_getrandom
356	i386	memfd_create		sys_memfd_create
357	i386	bpf			sys_bpf
358	i386	execveat		sys_execveat			stub32_execveat
Loading