summaryrefslogtreecommitdiff
path: root/arch/x86
diff options
context:
space:
mode:
authorVamshi K Sthambamkadi <vamshi.k.sthambamkadi@gmail.com>2020-08-28 14:32:46 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-09-09 20:12:30 +0300
commitcc6c4d81d6ad007ef66c07f35b0ba8f50f3a235a (patch)
tree899401439a477b8f92988a830a63abb2abf61b14 /arch/x86
parent036a857bb57dfc5b6866e924799aef820e842b53 (diff)
downloadlinux-cc6c4d81d6ad007ef66c07f35b0ba8f50f3a235a.tar.xz
tracing/kprobes, x86/ptrace: Fix regs argument order for i386
commit 2356bb4b8221d7dc8c7beb810418122ed90254c9 upstream. 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 <vamshi.k.sthambamkadi@gmail.com> Signed-off-by: Borislav Petkov <bp@suse.de> Acked-by: Masami Hiramatsu <mhiramat@kernel.org> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: <stable@vger.kernel.org> Link: https://lkml.kernel.org/r/20200828113242.GA1424@cosmos Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/include/asm/ptrace.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index 332eb3525867..902be2e6e96c 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -309,8 +309,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),