Skip to content

Commit 554086d

Browse files
amlutoH. Peter Anvin
authored andcommitted
x86_32, entry: Do syscall exit work on badsys (CVE-2014-4508)
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: [email protected] Cc: Roland McGrath <[email protected]> Reported-by: Toralf Förster <[email protected]> Signed-off-by: Andy Lutomirski <[email protected]> Link: http://lkml.kernel.org/r/e09c499eade6fc321266dd6b54da7beb28d6991c.1403558229.git.luto@amacapital.net Signed-off-by: H. Peter Anvin <[email protected]>
1 parent dda1e95 commit 554086d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

arch/x86/kernel/entry_32.S

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,9 +423,10 @@ sysenter_past_esp:
423423
jnz sysenter_audit
424424
sysenter_do_call:
425425
cmpl $(NR_syscalls), %eax
426-
jae syscall_badsys
426+
jae sysenter_badsys
427427
call *sys_call_table(,%eax,4)
428428
movl %eax,PT_EAX(%esp)
429+
sysenter_after_call:
429430
LOCKDEP_SYS_EXIT
430431
DISABLE_INTERRUPTS(CLBR_ANY)
431432
TRACE_IRQS_OFF
@@ -675,7 +676,12 @@ END(syscall_fault)
675676

676677
syscall_badsys:
677678
movl $-ENOSYS,PT_EAX(%esp)
678-
jmp resume_userspace
679+
jmp syscall_exit
680+
END(syscall_badsys)
681+
682+
sysenter_badsys:
683+
movl $-ENOSYS,PT_EAX(%esp)
684+
jmp sysenter_after_call
679685
END(syscall_badsys)
680686
CFI_ENDPROC
681687

0 commit comments

Comments
 (0)