From: Thomas Gleixner <tglx@linutronix.de>
To: Florian Weimer <fweimer@redhat.com>
Cc: Kevin Brodsky <kevin.brodsky@arm.com>,
Dmitry Vyukov <dvyukov@google.com>,
mathieu.desnoyers@efficios.com, peterz@infradead.org,
boqun.feng@gmail.com, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com, hpa@zytor.com,
aruna.ramakrishna@oracle.com, elver@google.com,
"Paul E. McKenney" <paulmck@kernel.org>,
x86@kernel.org, linux-kernel@vger.kernel.org,
Jens Axboe <axboe@kernel.dk>
Subject: Re: [PATCH v7 3/4] rseq: Make rseq work with protection keys
Date: Thu, 27 Nov 2025 15:38:39 +0100 [thread overview]
Message-ID: <87y0nrfsls.ffs@tglx> (raw)
In-Reply-To: <lhuecpk30ub.fsf@oldenburg.str.redhat.com>
On Wed, Nov 26 2025 at 23:06, Florian Weimer wrote:
> * Thomas Gleixner:
>> cur = pkey_extend(signal_perms);
>>
>> --> Perms are now [PK0=RW, PK1=R, PK2=RW, PK7=R]
>>
>> access_user_rseq();
>> pkey_set(cur);
>>
>> If the RSEQ access is nested in the signal delivery return then nothing
>> happens as the permissions are not changing because they are already
>> extended: A | A = A :).
>
> Agreed. And the pkey_extend/pkey_set don't have a prohibitive cost, I
> assume. I got the impression you were trying to avoid that sequence,
> but I think it's more about defining the way pkey_extend works.
Correct.
I was trying to avoid doing it on the exit to user path, but after
thinking more about it, I'm not so worried about it anymore.
With the recent rewrite of the RSEQ handling in the exit code path that
should more or less vanish in the noise. I'll hack something up and
evaluate the impact.
The real question is the semantics of this mechanism. In your proposed
patch you define it as (if I read it correctly):
1) The default signal protection is the same as the default for fork,
which is PKEY0 unless user space changes it.
2) pkey_alloc() with PKEY_ALLOC_SETSIGNAL set propagates the
protection to the signal mask/permission set
3) The permissions on signal delivery are:
(default & signal_mask) | signal_perms
I'm not entirely sure whether #3 is the right thing to do. My initial
thought was to keep the current permission set at the point where the
task got interrupted and expand it with the signal permissions, i.e:
(current & signal_mask) | signal_perms
Both variants can be argued for, but we have to agree on one them :)
Thanks,
tglx
next prev parent reply other threads:[~2025-11-27 14:38 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-21 8:47 [PATCH v7 0/4] rseq: Make rseq work with protection keys Dmitry Vyukov
2025-05-21 8:47 ` [PATCH v7 1/4] pkeys: add API to switch to permissive/zero pkey register Dmitry Vyukov
2025-05-21 8:47 ` [PATCH v7 2/4] x86/signal: Use write_permissive_pkey_val() helper Dmitry Vyukov
2025-05-21 8:47 ` [PATCH v7 3/4] rseq: Make rseq work with protection keys Dmitry Vyukov
2025-05-21 8:59 ` Dmitry Vyukov
2025-06-24 9:17 ` Dmitry Vyukov
2025-07-18 9:01 ` Dmitry Vyukov
2025-07-21 13:25 ` Mathieu Desnoyers
2025-07-21 17:41 ` Dave Hansen
2025-08-21 15:12 ` Dmitry Vyukov
2025-09-19 13:07 ` Dmitry Vyukov
2025-09-22 13:06 ` Mathieu Desnoyers
2025-10-20 13:46 ` Kevin Brodsky
2025-11-26 0:45 ` Thomas Gleixner
2025-11-26 9:32 ` Florian Weimer
2025-11-26 17:56 ` Thomas Gleixner
2025-11-26 19:06 ` Florian Weimer
2025-11-26 20:52 ` Thomas Gleixner
2025-11-26 22:06 ` Florian Weimer
2025-11-27 14:38 ` Thomas Gleixner [this message]
2025-12-02 19:19 ` Kevin Brodsky
2025-05-21 8:47 ` [PATCH v7 4/4] selftests/rseq: Add test for rseq+pkeys Dmitry Vyukov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y0nrfsls.ffs@tglx \
--to=tglx@linutronix.de \
--cc=aruna.ramakrishna@oracle.com \
--cc=axboe@kernel.dk \
--cc=boqun.feng@gmail.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=dvyukov@google.com \
--cc=elver@google.com \
--cc=fweimer@redhat.com \
--cc=hpa@zytor.com \
--cc=kevin.brodsky@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@redhat.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox