]> Git Repo - linux.git/commitdiff
tracing/kprobes, x86/ptrace: Fix regs argument order for i386
authorVamshi K Sthambamkadi <[email protected]>
Fri, 28 Aug 2020 11:32:46 +0000 (17:02 +0530)
committerBorislav Petkov <[email protected]>
Fri, 4 Sep 2020 12:40:42 +0000 (14:40 +0200)
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: 3c88ee194c28 ("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
arch/x86/include/asm/ptrace.h

index 40aa69d04862e1d00d82a2dd2fd5f3e7b7f495f3..d8324a23669610e379078543e3cbed3855aaae3e 100644 (file)
@@ -327,8 +327,8 @@ static inline unsigned long regs_get_kernel_argument(struct pt_regs *regs,
        static const unsigned int argument_offs[] = {
 #ifdef __i386__
                offsetof(struct pt_regs, ax),
-               offsetof(struct pt_regs, cx),
                offsetof(struct pt_regs, dx),
+               offsetof(struct pt_regs, cx),
 #define NR_REG_ARGUMENTS 3
 #else
                offsetof(struct pt_regs, di),
This page took 0.058598 seconds and 4 git commands to generate.