[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4e132957-c53c-4b06-9546-26d1de0a672f@csgroup.eu>
Date: Thu, 19 Nov 2020 18:18:23 +0100
From: Christophe Leroy <christophe.leroy@...roup.eu>
To: Oleg Nesterov <oleg@...hat.com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Madhavan Srinivasan <maddy@...ux.vnet.ibm.com>,
Michael Ellerman <mpe@...erman.id.au>,
Paul Mackerras <paulus@...ba.org>
Cc: Al Viro <viro@...iv.linux.org.uk>,
"Aneesh Kumar K.V" <aneesh.kumar@...ux.ibm.com>,
Christophe Leroy <christophe.leroy@....fr>,
Jan Kratochvil <jan.kratochvil@...hat.com>,
Nicholas Piggin <npiggin@...il.com>,
linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/2] powerpc/ptrace: Hard wire PT_SOFTE value to 1 in
gpr_get() too
Le 19/11/2020 à 17:02, Oleg Nesterov a écrit :
> The commit a8a4b03ab95f ("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: Jan Kratochvil <jan.kratochvil@...hat.com>
> Signed-off-by: Oleg Nesterov <oleg@...hat.com>
> ---
> arch/powerpc/kernel/ptrace/ptrace-tm.c | 8 +++++++-
> arch/powerpc/kernel/ptrace/ptrace-view.c | 8 +++++++-
> 2 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/kernel/ptrace/ptrace-tm.c b/arch/powerpc/kernel/ptrace/ptrace-tm.c
> index f8fcbd85d4cb..d0d339f86e61 100644
> --- a/arch/powerpc/kernel/ptrace/ptrace-tm.c
> +++ b/arch/powerpc/kernel/ptrace/ptrace-tm.c
> @@ -87,6 +87,10 @@ int tm_cgpr_get(struct task_struct *target, const struct user_regset *regset,
> struct membuf to)
> {
> 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));
Should fit on a single line I think.
> +#endif
>
> if (!cpu_has_feature(CPU_FTR_TM))
> return -ENODEV;
> @@ -102,7 +106,9 @@ int tm_cgpr_get(struct task_struct *target, const struct user_regset *regset,
> sizeof(struct user_pt_regs));
>
> 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) -
> sizeof(struct user_pt_regs));
> }
> diff --git a/arch/powerpc/kernel/ptrace/ptrace-view.c b/arch/powerpc/kernel/ptrace/ptrace-view.c
> index 39686ede40b3..f554ccfcbfae 100644
> --- a/arch/powerpc/kernel/ptrace/ptrace-view.c
> +++ b/arch/powerpc/kernel/ptrace/ptrace-view.c
> @@ -218,6 +218,10 @@ static int gpr_get(struct task_struct *target, const struct user_regset *regset,
> struct membuf to)
> {
> 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));
Should fit on a single line I think.
> +#endif
> int i;
>
> if (target->thread.regs == NULL)
> @@ -233,7 +237,9 @@ static int gpr_get(struct task_struct *target, const struct user_regset *regset,
> sizeof(struct user_pt_regs));
>
> 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) -
> sizeof(struct user_pt_regs));
> }
>
Christophe
Powered by blists - more mailing lists