x86: fix a bug introduced by "allocate full pt_regs" commit
PATCH 1/1 x86: fix a bug introduced by "allocate full pt_regs" commit
If syscall_trace_enter_phase1 returns 0,
code restores %rax from pt_regs->ax, but should restore it from pt_regs->orig_ax.
The bug crept in because LOAD_ARGS macro was very sublty different from RESTORE_ARGS, it had only two callsites and only this one was using that difference.
--- arch/x86/kernel/entry_64.S | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kernel/entry_64.S +2 -1
@@ -316,7 +316,8 @@ tracesys: call syscall_trace_enter_phase1 test %rax, %rax jnz tracesys_phase2 /* if needed, run the slow path */ - RESTORE_C_REGS /* else restore clobbered regs */ + RESTORE_C_REGS_EXCEPT_RAX /* else restore clobbered regs */ + movq ORIG_RAX(%rsp), %rax jmp system_call_fastpath /* and return to the fast path */ tracesys_phase2:
Signature · 1 line
1.8.1.4
Quoted 7 lines · Denys Vlasenko
If
syscall_trace_enter_phase1returns 0,
code restores %rax frompt_regs->ax, but should restore it frompt_regs->orig_ax.The bug crept in because
LOAD_ARGSmacro was very sublty different fromRESTORE_ARGS, it had only two callsites and only this one was using that difference.
I folded this in to the original patch to avoid breaking bisection. I put the missing -ARGOFFSET in and then removed it again in the appropriate place later in the series.
--Andy