[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <df3840a6-36ae-4429-80f2-b1f089917e2c@efficios.com>
Date: Fri, 23 May 2025 15:57:10 -0400
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: Prakash Sangappa <prakash.sangappa@...cle.com>,
linux-kernel@...r.kernel.org
Cc: peterz@...radead.org, rostedt@...dmis.org, tglx@...utronix.de,
bigeasy@...utronix.de, kprateek.nayak@....com
Subject: Re: [PATCH V4 6/6] Add API to query supported rseq cs flags
On 2025-05-13 17:45, Prakash Sangappa wrote:
> For the API, add a new flag to sys_rseq 'flags' argument called
> RSEQ_FLAG_QUERY_CS_FLAGS.
>
> When this flag is passed it returns a bit mask of all the supported
> rseq cs flags in the user provided rseq struct's 'flags' member.
>
> Suggested-by: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
> Signed-off-by: Prakash Sangappa <prakash.sangappa@...cle.com>
> ---
> include/uapi/linux/rseq.h | 1 +
> kernel/rseq.c | 17 +++++++++++++++++
> 2 files changed, 18 insertions(+)
>
> diff --git a/include/uapi/linux/rseq.h b/include/uapi/linux/rseq.h
> index 015534f064af..44baea9dd10a 100644
> --- a/include/uapi/linux/rseq.h
> +++ b/include/uapi/linux/rseq.h
> @@ -20,6 +20,7 @@ enum rseq_cpu_id_state {
>
> enum rseq_flags {
> RSEQ_FLAG_UNREGISTER = (1 << 0),
> + RSEQ_FLAG_QUERY_CS_FLAGS = (1 << 1),
> };
>
> enum rseq_cs_flags_bit {
> diff --git a/kernel/rseq.c b/kernel/rseq.c
> index c4bc52f8ba9c..997f7ca722ca 100644
> --- a/kernel/rseq.c
> +++ b/kernel/rseq.c
> @@ -576,6 +576,23 @@ SYSCALL_DEFINE4(rseq, struct rseq __user *, rseq, u32, rseq_len,
> return 0;
> }
>
> + /*
> + * return supported rseq_cs flags
> + * It is an or of all the rseq_cs_flags;
> + */
> + if (flags & RSEQ_FLAG_QUERY_CS_FLAGS) {
> + u32 rseq_csflags = RSEQ_CS_FLAG_NO_RESTART_ON_PREEMPT |
> + RSEQ_CS_FLAG_NO_RESTART_ON_SIGNAL |
> + RSEQ_CS_FLAG_NO_RESTART_ON_MIGRATE |
Those 3 flags (above) are already or'd by RSEQ_CS_NO_RESTART_FLAGS,
and they are all deprecated. See rseq_warn_flags().
So I would not return them within the set of supported
rseq flags.
Thanks,
Mathieu
> + RSEQ_CS_FLAG_DELAY_RESCHED |
> + RSEQ_CS_FLAG_RESCHEDULED;
> + if (!rseq)
> + return -EINVAL;
> + if (copy_to_user(&rseq->flags, &rseq_csflags, sizeof(u32)))
> + return -EFAULT;
> + return 0;
> + }
> +
> if (unlikely(flags))
> return -EINVAL;
>
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
Powered by blists - more mailing lists