* [PATCH] kprobes, x86/ptrace.h: fix regs argument order for i386
@ 2020-08-28 11:32 Vamshi K Sthambamkadi
2020-08-28 11:57 ` Masami Hiramatsu
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Vamshi K Sthambamkadi @ 2020-08-28 11:32 UTC (permalink / raw)
To: mhiramat, rostedt, mingo, davem, oleg, naveen.n.rao,
anil.s.keshavamurthy, tglx, bp, hpa
Cc: x86, linux-kernel
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.
Signed-off-by: Vamshi K Sthambamkadi <vamshi.k.sthambamkadi@gmail.com>
---
arch/x86/include/asm/ptrace.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index 40aa69d..d8324a2 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -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),
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] kprobes, x86/ptrace.h: fix regs argument order for i386
2020-08-28 11:32 [PATCH] kprobes, x86/ptrace.h: fix regs argument order for i386 Vamshi K Sthambamkadi
@ 2020-08-28 11:57 ` Masami Hiramatsu
2020-08-28 11:59 ` peterz
2020-09-04 12:49 ` [tip: x86/urgent] tracing/kprobes, x86/ptrace: Fix " tip-bot2 for Vamshi K Sthambamkadi
2 siblings, 0 replies; 4+ messages in thread
From: Masami Hiramatsu @ 2020-08-28 11:57 UTC (permalink / raw)
To: Vamshi K Sthambamkadi
Cc: rostedt, mingo, davem, oleg, naveen.n.rao, anil.s.keshavamurthy,
tglx, bp, hpa, x86, linux-kernel
On Fri, 28 Aug 2020 17:02:46 +0530
Vamshi K Sthambamkadi <vamshi.k.sthambamkadi@gmail.com> wrote:
> 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.
Good catch! BTW, this is for tracing (ftrace kprobe events), so the "tracing/kprobes:" tag is better.
Anyway,
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Thank you,
>
> Signed-off-by: Vamshi K Sthambamkadi <vamshi.k.sthambamkadi@gmail.com>
> ---
> arch/x86/include/asm/ptrace.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
> index 40aa69d..d8324a2 100644
> --- a/arch/x86/include/asm/ptrace.h
> +++ b/arch/x86/include/asm/ptrace.h
> @@ -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),
> --
> 2.7.4
>
--
Masami Hiramatsu <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] kprobes, x86/ptrace.h: fix regs argument order for i386
2020-08-28 11:32 [PATCH] kprobes, x86/ptrace.h: fix regs argument order for i386 Vamshi K Sthambamkadi
2020-08-28 11:57 ` Masami Hiramatsu
@ 2020-08-28 11:59 ` peterz
2020-09-04 12:49 ` [tip: x86/urgent] tracing/kprobes, x86/ptrace: Fix " tip-bot2 for Vamshi K Sthambamkadi
2 siblings, 0 replies; 4+ messages in thread
From: peterz @ 2020-08-28 11:59 UTC (permalink / raw)
To: Vamshi K Sthambamkadi
Cc: mhiramat, rostedt, mingo, davem, oleg, naveen.n.rao,
anil.s.keshavamurthy, tglx, bp, hpa, x86, linux-kernel
On Fri, Aug 28, 2020 at 05:02:46PM +0530, Vamshi K Sthambamkadi wrote:
> 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>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
> arch/x86/include/asm/ptrace.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
> index 40aa69d..d8324a2 100644
> --- a/arch/x86/include/asm/ptrace.h
> +++ b/arch/x86/include/asm/ptrace.h
> @@ -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),
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip: x86/urgent] tracing/kprobes, x86/ptrace: Fix regs argument order for i386
2020-08-28 11:32 [PATCH] kprobes, x86/ptrace.h: fix regs argument order for i386 Vamshi K Sthambamkadi
2020-08-28 11:57 ` Masami Hiramatsu
2020-08-28 11:59 ` peterz
@ 2020-09-04 12:49 ` tip-bot2 for Vamshi K Sthambamkadi
2 siblings, 0 replies; 4+ messages in thread
From: tip-bot2 for Vamshi K Sthambamkadi @ 2020-09-04 12:49 UTC (permalink / raw)
To: linux-tip-commits
Cc: Vamshi K Sthambamkadi, Borislav Petkov, Masami Hiramatsu,
Peter Zijlstra (Intel),
stable, x86, LKML
The following commit has been merged into the x86/urgent branch of tip:
Commit-ID: 2356bb4b8221d7dc8c7beb810418122ed90254c9
Gitweb: https://git.kernel.org/tip/2356bb4b8221d7dc8c7beb810418122ed90254c9
Author: Vamshi K Sthambamkadi <vamshi.k.sthambamkadi@gmail.com>
AuthorDate: Fri, 28 Aug 2020 17:02:46 +05:30
Committer: Borislav Petkov <bp@suse.de>
CommitterDate: Fri, 04 Sep 2020 14:40:42 +02:00
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: 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
---
arch/x86/include/asm/ptrace.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/ptrace.h b/arch/x86/include/asm/ptrace.h
index 40aa69d..d8324a2 100644
--- a/arch/x86/include/asm/ptrace.h
+++ b/arch/x86/include/asm/ptrace.h
@@ -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),
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-09-04 12:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-28 11:32 [PATCH] kprobes, x86/ptrace.h: fix regs argument order for i386 Vamshi K Sthambamkadi
2020-08-28 11:57 ` Masami Hiramatsu
2020-08-28 11:59 ` peterz
2020-09-04 12:49 ` [tip: x86/urgent] tracing/kprobes, x86/ptrace: Fix " tip-bot2 for Vamshi K Sthambamkadi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).