linux-api.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Piotr Figiel <figiel@google.com>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>,
	paulmck <paulmck@kernel.org>, Boqun Feng <boqun.feng@gmail.com>,
	Oleg Nesterov <oleg@redhat.com>,
	"Dmitry V. Levin" <ldv@altlinux.org>,
	Florian Weimer <fweimer@redhat.com>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	Andrei Vagin <avagin@gmail.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Peter Oskolkov <posk@google.com>,
	Kamil Yurtsever <kyurtsever@google.com>,
	Chris Kennelly <ckennelly@google.com>,
	Paul Turner <pjt@google.com>, emmir <emmir@google.com>,
	linux-man <linux-man@vger.kernel.org>,
	linux-api <linux-api@vger.kernel.org>
Subject: Re: [PATCH v2] ptrace: add PTRACE_GET_RSEQ_CONFIGURATION request
Date: Fri, 26 Feb 2021 17:06:29 +0100	[thread overview]
Message-ID: <YDkchUnCe5ctDwYB@google.com> (raw)
In-Reply-To: <192824546.8190.1614353555831.JavaMail.zimbra@efficios.com>

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).

Best regards, Piotr.

  parent reply	other threads:[~2021-02-26 16:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-26 13:51 [PATCH v2] ptrace: add PTRACE_GET_RSEQ_CONFIGURATION request Piotr Figiel
2021-02-26 15:32 ` Mathieu Desnoyers
2021-02-26 16:04   ` Michał Mirosław
2021-02-26 16:41     ` Mathieu Desnoyers
2021-02-26 16:06   ` Piotr Figiel [this message]
2021-03-03 18:55     ` Mathieu Desnoyers
2021-03-03 17:10   ` Florian Weimer
2021-03-10 18:50 ` Oleg Nesterov
2021-03-11 14:51 ` Mathieu Desnoyers
2021-03-11 16:51   ` Peter Zijlstra
2021-03-11 17:24     ` Mathieu Desnoyers

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=YDkchUnCe5ctDwYB@google.com \
    --to=figiel@google.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=avagin@gmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=ckennelly@google.com \
    --cc=emmir@google.com \
    --cc=fweimer@redhat.com \
    --cc=kyurtsever@google.com \
    --cc=ldv@altlinux.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=oleg@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=posk@google.com \
    /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;
as well as URLs for NNTP newsgroup(s).