Commit 324a6946 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Michael Ellerman

powerpc/ptrace: Hard wire PT_SOFTE value to 1 in gpr_get() too

The commit a8a4b03a ("powerpc: Hard wire PT_SOFTE value to 1 in
ptrace & signals") changed ptrace_get_reg(PT_SOFTE) to report 0x1,
but PTRACE_GETREGS still copies pt_regs->softe as is.

This is not consistent and this breaks the user-regs-peekpoke test
from https://sourceware.org/systemtap/wiki/utrace/tests/Reported-by: default avatarJan Kratochvil <jan.kratochvil@redhat.com>
Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201119160247.GB5188@redhat.com
parent 640586f8
...@@ -87,6 +87,9 @@ int tm_cgpr_get(struct task_struct *target, const struct user_regset *regset, ...@@ -87,6 +87,9 @@ int tm_cgpr_get(struct task_struct *target, const struct user_regset *regset,
struct membuf to) struct membuf to)
{ {
struct membuf to_msr = membuf_at(&to, offsetof(struct pt_regs, msr)); struct membuf to_msr = membuf_at(&to, offsetof(struct pt_regs, msr));
#ifdef CONFIG_PPC64
struct membuf to_softe = membuf_at(&to, offsetof(struct pt_regs, softe));
#endif
if (!cpu_has_feature(CPU_FTR_TM)) if (!cpu_has_feature(CPU_FTR_TM))
return -ENODEV; return -ENODEV;
...@@ -101,7 +104,9 @@ int tm_cgpr_get(struct task_struct *target, const struct user_regset *regset, ...@@ -101,7 +104,9 @@ int tm_cgpr_get(struct task_struct *target, const struct user_regset *regset,
membuf_write(&to, &target->thread.ckpt_regs, sizeof(struct user_pt_regs)); membuf_write(&to, &target->thread.ckpt_regs, sizeof(struct user_pt_regs));
membuf_store(&to_msr, get_user_ckpt_msr(target)); membuf_store(&to_msr, get_user_ckpt_msr(target));
#ifdef CONFIG_PPC64
membuf_store(&to_softe, 0x1ul);
#endif
return membuf_zero(&to, ELF_NGREG * sizeof(unsigned long) - return membuf_zero(&to, ELF_NGREG * sizeof(unsigned long) -
sizeof(struct user_pt_regs)); sizeof(struct user_pt_regs));
} }
......
...@@ -218,6 +218,9 @@ static int gpr_get(struct task_struct *target, const struct user_regset *regset, ...@@ -218,6 +218,9 @@ static int gpr_get(struct task_struct *target, const struct user_regset *regset,
struct membuf to) struct membuf to)
{ {
struct membuf to_msr = membuf_at(&to, offsetof(struct pt_regs, msr)); struct membuf to_msr = membuf_at(&to, offsetof(struct pt_regs, msr));
#ifdef CONFIG_PPC64
struct membuf to_softe = membuf_at(&to, offsetof(struct pt_regs, softe));
#endif
int i; int i;
if (target->thread.regs == NULL) if (target->thread.regs == NULL)
...@@ -232,7 +235,9 @@ static int gpr_get(struct task_struct *target, const struct user_regset *regset, ...@@ -232,7 +235,9 @@ static int gpr_get(struct task_struct *target, const struct user_regset *regset,
membuf_write(&to, target->thread.regs, sizeof(struct user_pt_regs)); membuf_write(&to, target->thread.regs, sizeof(struct user_pt_regs));
membuf_store(&to_msr, get_user_msr(target)); membuf_store(&to_msr, get_user_msr(target));
#ifdef CONFIG_PPC64
membuf_store(&to_softe, 0x1ul);
#endif
return membuf_zero(&to, ELF_NGREG * sizeof(unsigned long) - return membuf_zero(&to, ELF_NGREG * sizeof(unsigned long) -
sizeof(struct user_pt_regs)); sizeof(struct user_pt_regs));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment