aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/ia32
diff options
context:
space:
mode:
authorJan Beulich <JBeulich@novell.com>2009-10-26 11:20:29 -0400
committerIngo Molnar <mingo@elte.hu>2009-10-26 11:23:26 -0400
commit81766741fe1eee3884219e8daaf03f466f2ed52f (patch)
tree0afde40852f608ed101d03a83ef49ef74ccbb434 /arch/x86/ia32
parent72ed7de74e8f0fad0d8e567ae1f987b740accb3f (diff)
x86-64: Fix register leak in 32-bit syscall audting
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: Jan Beulich <jbeulich@novell.com> Acked-by: Roland McGrath <roland@redhat.com> Cc: <stable@kernel.org> LKML-Reference: <4AE5CC4D020000780001BD13@vpn.id2.novell.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/ia32')
-rw-r--r--arch/x86/ia32/ia32entry.S5
1 files changed, 2 insertions, 3 deletions
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
index 1733f9f65e82..581b0568fe19 100644
--- a/arch/x86/ia32/ia32entry.S
+++ b/arch/x86/ia32/ia32entry.S
@@ -204,7 +204,7 @@ sysexit_from_sys_call:
204 movl RDI-ARGOFFSET(%rsp),%r8d /* reload 5th syscall arg */ 204 movl RDI-ARGOFFSET(%rsp),%r8d /* reload 5th syscall arg */
205 .endm 205 .endm
206 206
207 .macro auditsys_exit exit,ebpsave=RBP 207 .macro auditsys_exit exit
208 testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),TI_flags(%r10) 208 testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),TI_flags(%r10)
209 jnz ia32_ret_from_sys_call 209 jnz ia32_ret_from_sys_call
210 TRACE_IRQS_ON 210 TRACE_IRQS_ON
@@ -217,7 +217,6 @@ sysexit_from_sys_call:
217 call audit_syscall_exit 217 call audit_syscall_exit
218 GET_THREAD_INFO(%r10) 218 GET_THREAD_INFO(%r10)
219 movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall return value */ 219 movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall return value */
220 movl \ebpsave-ARGOFFSET(%rsp),%ebp /* reload user register value */
221 movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),%edi 220 movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),%edi
222 cli 221 cli
223 TRACE_IRQS_OFF 222 TRACE_IRQS_OFF
@@ -351,7 +350,7 @@ cstar_auditsys:
351 jmp cstar_dispatch 350 jmp cstar_dispatch
352 351
353sysretl_audit: 352sysretl_audit:
354 auditsys_exit sysretl_from_sys_call, RCX /* user %ebp in RCX slot */ 353 auditsys_exit sysretl_from_sys_call
355#endif 354#endif
356 355
357cstar_tracesys: 356cstar_tracesys: