Commit 092afb74 authored by Jan Beulich's avatar Jan Beulich Committed by Greg Kroah-Hartman

x86-64: Fix register leak in 32-bit syscall audting

commit 81766741 upstream.

Restoring %ebp after the call to audit_syscall_exit() is not
only unnecessary (because the register didn't get clobbered),
but in the sysenter case wasn't even doing the right thing: It
loaded %ebp from a location below the top of stack (RBP <
ARGOFFSET), i.e. arbitrary kernel data got passed back to user
mode in the register.
Signed-off-by: default avatarJan Beulich <jbeulich@novell.com>
Acked-by: default avatarRoland McGrath <roland@redhat.com>
LKML-Reference: <4AE5CC4D020000780001BD13@vpn.id2.novell.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 82a90819
...@@ -204,7 +204,7 @@ sysexit_from_sys_call: ...@@ -204,7 +204,7 @@ sysexit_from_sys_call:
movl RDI-ARGOFFSET(%rsp),%r8d /* reload 5th syscall arg */ movl RDI-ARGOFFSET(%rsp),%r8d /* reload 5th syscall arg */
.endm .endm
.macro auditsys_exit exit,ebpsave=RBP .macro auditsys_exit exit
testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),TI_flags(%r10) testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),TI_flags(%r10)
jnz ia32_ret_from_sys_call jnz ia32_ret_from_sys_call
TRACE_IRQS_ON TRACE_IRQS_ON
...@@ -217,7 +217,6 @@ sysexit_from_sys_call: ...@@ -217,7 +217,6 @@ sysexit_from_sys_call:
call audit_syscall_exit call audit_syscall_exit
GET_THREAD_INFO(%r10) GET_THREAD_INFO(%r10)
movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall return value */ movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall return value */
movl \ebpsave-ARGOFFSET(%rsp),%ebp /* reload user register value */
movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),%edi movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),%edi
cli cli
TRACE_IRQS_OFF TRACE_IRQS_OFF
...@@ -351,7 +350,7 @@ cstar_auditsys: ...@@ -351,7 +350,7 @@ cstar_auditsys:
jmp cstar_dispatch jmp cstar_dispatch
sysretl_audit: sysretl_audit:
auditsys_exit sysretl_from_sys_call, RCX /* user %ebp in RCX slot */ auditsys_exit sysretl_from_sys_call
#endif #endif
cstar_tracesys: cstar_tracesys:
......
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