Skip to content

Commit b8f4d21

Browse files
amlutoJiri Slaby
authored andcommitted
x86_32, entry: Do syscall exit work on badsys (CVE-2014-4508)
commit 554086d upstream. The bad syscall nr paths are their own incomprehensible route through the entry control flow. Rearrange them to work just like syscalls that return -ENOSYS. This fixes an OOPS in the audit code when fast-path auditing is enabled and sysenter gets a bad syscall nr (CVE-2014-4508). This has probably been broken since Linux 2.6.27: af0575b i386 syscall audit fast-path Cc: Roland McGrath <roland@redhat.com> Reported-by: Toralf Förster <toralf.foerster@gmx.de> Signed-off-by: Andy Lutomirski <luto@amacapital.net> Link: http://lkml.kernel.org/r/e09c499eade6fc321266dd6b54da7beb28d6991c.1403558229.git.luto@amacapital.net Signed-off-by: H. Peter Anvin <hpa@linux.intel.com> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
1 parent 8cef3ce commit b8f4d21

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎arch/x86/kernel/entry_32.S‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,10 @@ sysenter_past_esp:
434434
jnz sysenter_audit
435435
sysenter_do_call:
436436
cmpl $(NR_syscalls), %eax
437-
jae syscall_badsys
437+
jae sysenter_badsys
438438
call *sys_call_table(,%eax,4)
439439
movl %eax,PT_EAX(%esp)
440+
sysenter_after_call:
440441
LOCKDEP_SYS_EXIT
441442
DISABLE_INTERRUPTS(CLBR_ANY)
442443
TRACE_IRQS_OFF
@@ -686,7 +687,12 @@ END(syscall_fault)
686687

687688
syscall_badsys:
688689
movl $-ENOSYS,PT_EAX(%esp)
689-
jmp resume_userspace
690+
jmp syscall_exit
691+
END(syscall_badsys)
692+
693+
sysenter_badsys:
694+
movl $-ENOSYS,PT_EAX(%esp)
695+
jmp sysenter_after_call
690696
END(syscall_badsys)
691697
CFI_ENDPROC
692698
/*

0 commit comments

Comments
 (0)