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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <42bc968e-183d-44f4-9abb-6a88ed7d49c8@efficios.com>
Date: Thu, 11 Sep 2025 13:18:53 -0400
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: K Prateek Nayak <kprateek.nayak@....com>,
 Thomas Gleixner <tglx@...utronix.de>, LKML <linux-kernel@...r.kernel.org>
Cc: Peter Zijlstra <peterz@...radead.org>,
 "Paul E. McKenney" <paulmck@...nel.org>, Boqun Feng <boqun.feng@...il.com>,
 Jonathan Corbet <corbet@....net>,
 Prakash Sangappa <prakash.sangappa@...cle.com>,
 Madadi Vineeth Reddy <vineethr@...ux.ibm.com>,
 Steven Rostedt <rostedt@...dmis.org>,
 Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
 Arnd Bergmann <arnd@...db.de>, linux-arch@...r.kernel.org
Subject: Re: [patch 05/12] rseq: Add prctl() to enable time slice extensions

On 2025-09-11 12:52, K Prateek Nayak wrote:
> Hello Mathieu,
> 
> On 9/11/2025 9:20 PM, Mathieu Desnoyers wrote:
>>>    +int rseq_slice_extension_prctl(unsigned long arg2, unsigned long arg3)
>>> +{
>>> +    switch (arg2) {
>>> +    case PR_RSEQ_SLICE_EXTENSION_GET:
>>> +        if (arg3)
>>> +            return -EINVAL;
>>> +        return current->rseq.slice.state.enabled ? PR_RSEQ_SLICE_EXT_ENABLE : 0;
>>> +
>>> +    case PR_RSEQ_SLICE_EXTENSION_SET: {
>>> +        u32 rflags, valid = RSEQ_CS_FLAG_SLICE_EXT_AVAILABLE;
>>> +        bool enable = !!(arg3 & PR_RSEQ_SLICE_EXT_ENABLE);
>>> +
>>> +        if (arg3 & ~PR_RSEQ_SLICE_EXT_ENABLE)
>>> +            return -EINVAL;
>>> +        if (!rseq_slice_extension_enabled())
>>> +            return -ENOTSUPP;
>>> +        if (!current->rseq.usrptr)
>>> +            return -ENXIO;
>>> +
>>> +        /* No change? */
>>> +        if (enable == !!current->rseq.slice.state.enabled)
>>> +            return 0;
>>> +
>>> +        if (get_user(rflags, &current->rseq.usrptr->flags))
>>> +            goto die;
>>> +
>>> +        if (current->rseq.slice.state.enabled)
>>> +            valid |= RSEQ_CS_FLAG_SLICE_EXT_ENABLED;
>>> +
>>> +        if ((rflags & valid) != valid)
>>> +            goto die;
>>> +
>>> +        rflags &= ~RSEQ_CS_FLAG_SLICE_EXT_ENABLED;
>>> +        rflags |= RSEQ_CS_FLAG_SLICE_EXT_AVAILABLE;
>>> +        if (enable)
>>> +            rflags |= RSEQ_CS_FLAG_SLICE_EXT_ENABLED;
>>> +
>>> +        if (put_user(rflags, &current->rseq.usrptr->flags))
>>> +            goto die;
>>> +
>>> +        current->rseq.slice.state.enabled = enable;
>>
>> What should happen to this enabled state if rseq is unregistered
>> after this prctl ?
> 
> Wouldn't rseq_reset() deal with it since it does a:
> 
>      memset(&t->rseq, 0, sizeof(t->rseq));
> 

Good point, thanks!

Mathieu


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ