Skip to content

Commit 2356bb4

Browse files
Vamshi K Sthambamkadisuryasaimadhu
authored andcommitted
tracing/kprobes, x86/ptrace: Fix regs argument order for i386
On i386, the order of parameters passed on regs is eax,edx,and ecx (as per regparm(3) calling conventions). Change the mapping in regs_get_kernel_argument(), so that arg1=ax arg2=dx, and arg3=cx. Running the selftests testcase kprobes_args_use.tc shows the result as passed. Fixes: 3c88ee1 ("x86: ptrace: Add function argument access API") Signed-off-by: Vamshi K Sthambamkadi <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Acked-by: Masami Hiramatsu <[email protected]> Acked-by: Peter Zijlstra (Intel) <[email protected]> Cc: <[email protected]> Link: https://lkml.kernel.org/r/20200828113242.GA1424@cosmos
1 parent ccae0f3 commit 2356bb4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/include/asm/ptrace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,8 @@ static inline unsigned long regs_get_kernel_argument(struct pt_regs *regs,
327327
static const unsigned int argument_offs[] = {
328328
#ifdef __i386__
329329
offsetof(struct pt_regs, ax),
330-
offsetof(struct pt_regs, cx),
331330
offsetof(struct pt_regs, dx),
331+
offsetof(struct pt_regs, cx),
332332
#define NR_REG_ARGUMENTS 3
333333
#else
334334
offsetof(struct pt_regs, di),

0 commit comments

Comments
 (0)