Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 337645
Collapse All | Expand All

(-)a/arch/x86/ia32/ia32entry.S (-8 / +14 lines)
Lines 51-57 Link Here
51
	/*
51
	/*
52
	 * Reload arg registers from stack in case ptrace changed them.
52
	 * Reload arg registers from stack in case ptrace changed them.
53
	 * We don't reload %eax because syscall_trace_enter() returned
53
	 * We don't reload %eax because syscall_trace_enter() returned
54
	 * the value it wants us to use in the table lookup.
54
	 * the %rax value we should see.  Instead, we just truncate that
55
	 * value to 32 bits again as we did on entry from user mode.
56
	 * If it's a new value set by user_regset during entry tracing,
57
	 * this matches the normal truncation of the user-mode value.
58
	 * If it's -1 to make us punt the syscall, then (u32)-1 is still
59
	 * an appropriately invalid value.
55
	 */
60
	 */
56
	.macro LOAD_ARGS32 offset, _r9=0
61
	.macro LOAD_ARGS32 offset, _r9=0
57
	.if \_r9
62
	.if \_r9
Lines 61-66 Link Here
61
	movl \offset+48(%rsp),%edx
66
	movl \offset+48(%rsp),%edx
62
	movl \offset+56(%rsp),%esi
67
	movl \offset+56(%rsp),%esi
63
	movl \offset+64(%rsp),%edi
68
	movl \offset+64(%rsp),%edi
69
	movl %eax,%eax			/* zero extension */
64
	.endm
70
	.endm
65
	
71
	
66
	.macro CFI_STARTPROC32 simple
72
	.macro CFI_STARTPROC32 simple
Lines 165-171 Link Here
165
	testl  $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
171
	testl  $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
166
	CFI_REMEMBER_STATE
172
	CFI_REMEMBER_STATE
167
	jnz  sysenter_tracesys
173
	jnz  sysenter_tracesys
168
	cmpl	$(IA32_NR_syscalls-1),%eax
174
	cmpq	$(IA32_NR_syscalls-1),%rax
169
	ja	ia32_badsys
175
	ja	ia32_badsys
170
sysenter_do_call:
176
sysenter_do_call:
171
	IA32_ARG_FIXUP
177
	IA32_ARG_FIXUP
Lines 212-218 Link Here
212
	movl $AUDIT_ARCH_I386,%edi	/* 1st arg: audit arch */
218
	movl $AUDIT_ARCH_I386,%edi	/* 1st arg: audit arch */
213
	call audit_syscall_entry
219
	call audit_syscall_entry
214
	movl RAX-ARGOFFSET(%rsp),%eax	/* reload syscall number */
220
	movl RAX-ARGOFFSET(%rsp),%eax	/* reload syscall number */
215
	cmpl $(IA32_NR_syscalls-1),%eax
221
	cmpq $(IA32_NR_syscalls-1),%rax
216
	ja ia32_badsys
222
	ja ia32_badsys
217
	movl %ebx,%edi			/* reload 1st syscall arg */
223
	movl %ebx,%edi			/* reload 1st syscall arg */
218
	movl RCX-ARGOFFSET(%rsp),%esi	/* reload 2nd syscall arg */
224
	movl RCX-ARGOFFSET(%rsp),%esi	/* reload 2nd syscall arg */
Lines 265-271 Link Here
265
	call	syscall_trace_enter
271
	call	syscall_trace_enter
266
	LOAD_ARGS32 ARGOFFSET  /* reload args from stack in case ptrace changed it */
272
	LOAD_ARGS32 ARGOFFSET  /* reload args from stack in case ptrace changed it */
267
	RESTORE_REST
273
	RESTORE_REST
268
	cmpl	$(IA32_NR_syscalls-1),%eax
274
	cmpq	$(IA32_NR_syscalls-1),%rax
269
	ja	int_ret_from_sys_call /* sysenter_tracesys has set RAX(%rsp) */
275
	ja	int_ret_from_sys_call /* sysenter_tracesys has set RAX(%rsp) */
270
	jmp	sysenter_do_call
276
	jmp	sysenter_do_call
271
	CFI_ENDPROC
277
	CFI_ENDPROC
Lines 342-348 Link Here
342
	testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
348
	testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
343
	CFI_REMEMBER_STATE
349
	CFI_REMEMBER_STATE
344
	jnz   cstar_tracesys
350
	jnz   cstar_tracesys
345
	cmpl $IA32_NR_syscalls-1,%eax
351
	cmpq $IA32_NR_syscalls-1,%rax
346
	ja  ia32_badsys
352
	ja  ia32_badsys
347
cstar_do_call:
353
cstar_do_call:
348
	IA32_ARG_FIXUP 1
354
	IA32_ARG_FIXUP 1
Lines 400-406 Link Here
400
	LOAD_ARGS32 ARGOFFSET, 1  /* reload args from stack in case ptrace changed it */
406
	LOAD_ARGS32 ARGOFFSET, 1  /* reload args from stack in case ptrace changed it */
401
	RESTORE_REST
407
	RESTORE_REST
402
	xchgl %ebp,%r9d
408
	xchgl %ebp,%r9d
403
	cmpl $(IA32_NR_syscalls-1),%eax
409
	cmpq $(IA32_NR_syscalls-1),%rax
404
	ja int_ret_from_sys_call /* cstar_tracesys has set RAX(%rsp) */
410
	ja int_ret_from_sys_call /* cstar_tracesys has set RAX(%rsp) */
405
	jmp cstar_do_call
411
	jmp cstar_do_call
406
END(ia32_cstar_target)
412
END(ia32_cstar_target)
Lines 463-469 Link Here
463
	orl   $TS_COMPAT,TI_status(%r10)
469
	orl   $TS_COMPAT,TI_status(%r10)
464
	testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
470
	testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
465
	jnz ia32_tracesys
471
	jnz ia32_tracesys
466
	cmpl $(IA32_NR_syscalls-1),%eax
472
	cmpq $(IA32_NR_syscalls-1),%rax
467
	ja ia32_badsys
473
	ja ia32_badsys
468
ia32_do_call:
474
ia32_do_call:
469
	IA32_ARG_FIXUP
475
	IA32_ARG_FIXUP
Lines 482-488 Link Here
482
	call syscall_trace_enter
488
	call syscall_trace_enter
483
	LOAD_ARGS32 ARGOFFSET  /* reload args from stack in case ptrace changed it */
489
	LOAD_ARGS32 ARGOFFSET  /* reload args from stack in case ptrace changed it */
484
	RESTORE_REST
490
	RESTORE_REST
485
	cmpl $(IA32_NR_syscalls-1),%eax
491
	cmpq $(IA32_NR_syscalls-1),%rax
486
	ja  int_ret_from_sys_call	/* ia32_tracesys has set RAX(%rsp) */
492
	ja  int_ret_from_sys_call	/* ia32_tracesys has set RAX(%rsp) */
487
	jmp ia32_do_call
493
	jmp ia32_do_call
488
END(ia32_syscall)
494
END(ia32_syscall)

Return to bug 337645