lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 26 Feb 2021 11:41:54 -0500 (EST)
From:   Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To:     emmir <emmir@...gle.com>
Cc:     Piotr Figiel <figiel@...gle.com>,
        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>,
        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:04 AM, emmir emmir@...gle.com wrote:

> On Fri, 26 Feb 2021 at 16:32, Mathieu Desnoyers
> <mathieu.desnoyers@...icios.com> wrote:
>>
>> ----- On Feb 26, 2021, at 8:51 AM, Piotr Figiel figiel@...gle.com wrote:
>> [...]
>> > ---
>> > v2:
>> > Applied review comments:
>> > - changed return value from the ptrace request to the size of the
>> >   configuration structure
>> > - expanded configuration structure with the flags field and
>> >   the rseq abi structure size
>> >
>> [...]
>> > +#define PTRACE_GET_RSEQ_CONFIGURATION        0x420f
>> > +
>> > +struct ptrace_rseq_configuration {
>> > +     __u64 rseq_abi_pointer;
>> > +     __u32 rseq_abi_size;
>> > +     __u32 signature;
>> > +     __u32 flags;
>> > +     __u32 pad;
>> > +};
>> > +
>> [...]
>> > +#ifdef CONFIG_RSEQ
>> > +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.
>>
>> Florian, did I understand your request correctly, or am I missing your point ?
> 
> In this case returning sizeof(conf) would serve the same purpose, wouldn't it?

If the size is received as input from user-space as well, this can be used to
make sure the kernel detects what size is expected by user-space and act accordingly.

Thanks,

Mathieu

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ