[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <321e6865-1762-c459-56c4-0cc89c7c2a7e@linux.ibm.com>
Date: Thu, 11 Jun 2020 14:22:30 +0530
From: Madhavan Srinivasan <maddy@...ux.ibm.com>
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: Jan Kratochvil <jan.kratochvil@...hat.com>,
linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH? v2] powerpc: Hard wire PT_SOFTE value to 1 in gpr_get()
too
On 6/10/20 8:37 PM, Oleg Nesterov wrote:
> Hi,
>
> looks like this patch was forgotten.
yep, I missed this. But mpe did have comments for the patch.
https://lkml.org/lkml/2019/9/19/107
Maddy
>
> Do you think this should be fixed or should we document that
> PTRACE_GETREGS is not consistent with PTRACE_PEEKUSER on ppc64?
>
>
> On 09/17, Oleg Nesterov wrote:
>> I don't have a ppc machine, this patch wasn't even compile tested,
>> could you please review?
>>
>> 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
>> http://sourceware.org/systemtap/wiki/utrace/tests/user-regs-peekpoke
>>
>> Reported-by: Jan Kratochvil <jan.kratochvil@...hat.com>
>> Signed-off-by: Oleg Nesterov <oleg@...hat.com>
>> ---
>> arch/powerpc/kernel/ptrace.c | 25 +++++++++++++++++++++++++
>> 1 file changed, 25 insertions(+)
>>
>> diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
>> index 8c92feb..291acfb 100644
>> --- a/arch/powerpc/kernel/ptrace.c
>> +++ b/arch/powerpc/kernel/ptrace.c
>> @@ -363,11 +363,36 @@ static int gpr_get(struct task_struct *target, const struct user_regset *regset,
>> BUILD_BUG_ON(offsetof(struct pt_regs, orig_gpr3) !=
>> offsetof(struct pt_regs, msr) + sizeof(long));
>>
>> +#ifdef CONFIG_PPC64
>> + if (!ret)
>> + ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
>> + &target->thread.regs->orig_gpr3,
>> + offsetof(struct pt_regs, orig_gpr3),
>> + offsetof(struct pt_regs, softe));
>> +
>> + if (!ret) {
>> + unsigned long softe = 0x1;
>> + ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &softe,
>> + offsetof(struct pt_regs, softe),
>> + offsetof(struct pt_regs, softe) +
>> + sizeof(softe));
>> + }
>> +
>> + BUILD_BUG_ON(offsetof(struct pt_regs, trap) !=
>> + offsetof(struct pt_regs, softe) + sizeof(long));
>> +
>> + if (!ret)
>> + ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
>> + &target->thread.regs->trap,
>> + offsetof(struct pt_regs, trap),
>> + sizeof(struct user_pt_regs));
>> +#else
>> if (!ret)
>> ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
>> &target->thread.regs->orig_gpr3,
>> offsetof(struct pt_regs, orig_gpr3),
>> sizeof(struct user_pt_regs));
>> +#endif
>> if (!ret)
>> ret = user_regset_copyout_zero(&pos, &count, &kbuf, &ubuf,
>> sizeof(struct user_pt_regs), -1);
>> --
>> 2.5.0
>>
Powered by blists - more mailing lists