[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 3 Mar 2021 13:55:39 -0500 (EST)
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: Piotr Figiel <figiel@...gle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
paulmck <paulmck@...nel.org>, Boqun Feng <boqun.feng@...il.com>,
Oleg Nesterov <oleg@...hat.com>,
"Dmitry V. Levin" <ldv@...linux.org>,
Florian Weimer <fweimer@...hat.com>,
Alexey Dobriyan <adobriyan@...il.com>,
Andrei Vagin <avagin@...il.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Peter Oskolkov <posk@...gle.com>,
Kamil Yurtsever <kyurtsever@...gle.com>,
Chris Kennelly <ckennelly@...gle.com>,
Paul Turner <pjt@...gle.com>, emmir <emmir@...gle.com>,
linux-man <linux-man@...r.kernel.org>,
linux-api <linux-api@...r.kernel.org>
Subject: Re: [PATCH v2] ptrace: add PTRACE_GET_RSEQ_CONFIGURATION request
----- On Feb 26, 2021, at 11:06 AM, Piotr Figiel figiel@...gle.com wrote:
> Hi,
>
> On Fri, Feb 26, 2021 at 10:32:35AM -0500, Mathieu Desnoyers wrote:
>> > +static long ptrace_get_rseq_configuration(struct task_struct *task,
>> > + unsigned long size, void __user *data)
>> > +{
>> > + struct ptrace_rseq_configuration conf = {
>> > + .rseq_abi_pointer = (u64)(uintptr_t)task->rseq,
>> > + .rseq_abi_size = sizeof(*task->rseq),
>> > + .signature = task->rseq_sig,
>> > + .flags = 0,
>> > + };
>> > +
>> > + size = min_t(unsigned long, size, sizeof(conf));
>> > + if (copy_to_user(data, &conf, size))
>> > + return -EFAULT;
>> > + return sizeof(conf);
>> > +}
>>
>> I think what Florian was after would be:
>>
>> struct ptrace_rseq_configuration {
>> __u32 size; /* size of struct ptrace_rseq_configuration */
>> __u32 flags;
>> __u64 rseq_abi_pointer;
>> __u32 signature;
>> __u32 pad;
>> };
>>
>> where:
>>
>> .size = sizeof(struct ptrace_rseq_configuration),
>>
>> This way, the configuration structure can be expanded in the future. The
>> rseq ABI structure is by definition fixed-size, so there is no point in
>> having its size here.
>
> Still rseq syscall accepts the rseq ABI structure size as a paremeter.
> I think this way the information returned from ptrace is consistent with
> the userspace view of the rseq state and allows expansion in case the
> ABI structure would have to be extended (in spite of it's current
> definition).
>
> The configuration structure still can be expanded as its size is
> reported to userspace as return value from the request (in line with
> Dmitry's comments).
Fair enough. And now with the reply from Florian I see that I misunderstood his
point.
Thanks,
Mathieu
>
> Best regards, Piotr.
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
Powered by blists - more mailing lists