Skip to content

Commit 024e8ac

Browse files
author
Roland McGrath
committed
x86_64: fix ia32 AMD syscall audit fast-path
The new code in commit 5cbf156 has a bug in the version supporting the AMD 'syscall' instruction. It clobbers the user's %ecx register value (with the %ebp value). This change fixes it. Signed-off-by: Roland McGrath <roland@redhat.com>
1 parent 1ff8419 commit 024e8ac

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎arch/x86/ia32/ia32entry.S‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ sysexit_from_sys_call:
201201
movl RDI-ARGOFFSET(%rsp),%r8d /* reload 5th syscall arg */
202202
.endm
203203

204-
.macro auditsys_exit exit
204+
.macro auditsys_exit exit,ebpsave=RBP
205205
testl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),TI_flags(%r10)
206206
jnz int_ret_from_sys_call
207207
TRACE_IRQS_ON
@@ -214,7 +214,7 @@ sysexit_from_sys_call:
214214
call audit_syscall_exit
215215
GET_THREAD_INFO(%r10)
216216
movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall return value */
217-
movl RBP-ARGOFFSET(%rsp),%ebp /* reload user register value */
217+
movl \ebpsave-ARGOFFSET(%rsp),%ebp /* reload user register value */
218218
movl $(_TIF_ALLWORK_MASK & ~_TIF_SYSCALL_AUDIT),%edi
219219
cli
220220
TRACE_IRQS_OFF
@@ -347,7 +347,7 @@ cstar_auditsys:
347347
jmp cstar_dispatch
348348

349349
sysretl_audit:
350-
auditsys_exit sysretl_from_sys_call
350+
auditsys_exit sysretl_from_sys_call, RCX /* user %ebp in RCX slot */
351351
#endif
352352

353353
cstar_tracesys:

0 commit comments

Comments
 (0)