From: Linus Torvalds <torvalds@linux-foundation.org>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux API <linux-api@vger.kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Paul McKenney <paulmck@linux.vnet.ibm.com>,
Boqun Feng <boqun.feng@gmail.com>,
Andy Lutomirski <luto@amacapital.net>,
Dave Watson <davejwatson@fb.com>, Paul Turner <pjt@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Russell King - ARM Linux <linux@arm.linux.org.uk>,
Ingo Molnar <mingo@redhat.com>, Peter Anvin <hpa@zytor.com>,
Andi Kleen <andi@firstfloor.org>,
Christoph Lameter <cl@linux.com>, Ben Maurer <bmaurer@fb.com>,
Steven Rostedt <rostedt@goodmis.org>,
Josh Triplett <josh@joshtriplett.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>
Subject: Re: [RFC PATCH for 4.18] rseq: use __u64 for rseq_cs fields, validate user inputs
Date: Mon, 2 Jul 2018 15:45:01 -0700 [thread overview]
Message-ID: <CA+55aFxrX+wRoe+5HDaTrRXg1K-Qpks4jJ9Buc_OevoG8hoGFw@mail.gmail.com> (raw)
In-Reply-To: <20180702223143.4663-1-mathieu.desnoyers@efficios.com>
On Mon, Jul 2, 2018 at 3:31 PM Mathieu Desnoyers
<mathieu.desnoyers@efficios.com> wrote:
>
> Change the rseq ABI so rseq_cs start_ip, post_commit_offset and abort_ip
> fields are seen as 64-bit fields by both 32-bit and 64-bit kernels rather
> that ignoring the 32 upper bits on 32-bit kernels. This ensures we have a
> consistent behavior for a 32-bit binary executed on 32-bit kernels and in
> compat mode on 64-bit kernels.
Actually, now that I see this again, I react to:
> +static int check_rseq_cs_padding(struct task_struct *t)
> +{
> + u32 pad;
> + int ret;
> +
> + ret = __get_user(pad, &t->rseq->rseq_cs_padding);
> + if (ret)
> + return ret;
> + if (pad)
> + return -EINVAL;
> + return 0;
> +}
This is all wrong.
Just make "rseq_cs" be an __u64" too. That will clean up everything,
and user space will have a much easier time filling it in too, since
it's just one field. Instead of having to remember about the "let's
fill in padding for 32-bit cases".
Then the rseq_get_rseq_cs() will be
__u64 rseq_cs;
ret = get_user(rseq_cs, &t->rseq->rseq_cs);
if (ret)
return ret;
ptr = (void *)rseq_cs;
if (rseq_cs != (unsigned long)ptr)
return -EINVAL;
and it's all good, no #ifdef's etc needed.
Hmm?
Sorry for the bike-shedding, but this is now the last remaining user
of that LINUX_FIELD_u32_u64, so let's just get rid of it entirely, ok?
Then we can also get rid of that silly uapi/linux/types_32_64.h header
file entirely.
That would be *lovely*. Simpler code, simpler and less error-prone
interfaces, and one less specialized header file.
Linus
next prev parent reply other threads:[~2018-07-02 22:45 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-02 22:31 [RFC PATCH for 4.18] rseq: use __u64 for rseq_cs fields, validate user inputs Mathieu Desnoyers
2018-07-02 22:45 ` Linus Torvalds [this message]
2018-07-02 23:00 ` Mathieu Desnoyers
2018-07-02 23:06 ` Linus Torvalds
2018-07-02 23:16 ` Mathieu Desnoyers
2018-07-02 23:22 ` Linus Torvalds
2018-07-02 23:25 ` Mathieu Desnoyers
2018-07-02 23:22 ` Mathieu Desnoyers
2018-07-02 23:37 ` Andy Lutomirski
2018-07-03 1:19 ` Mathieu Desnoyers
2018-07-03 2:01 ` Mathieu Desnoyers
2018-07-03 2:18 ` Linus Torvalds
2018-07-03 2:30 ` Mathieu Desnoyers
2018-07-03 2:33 ` Andy Lutomirski
2018-07-03 2:44 ` Linus Torvalds
2018-07-03 8:14 ` Peter Zijlstra
2018-07-03 8:29 ` Heiko Carstens
2018-07-03 8:43 ` Peter Zijlstra
2018-07-03 8:55 ` Heiko Carstens
2018-07-03 9:17 ` Heiko Carstens
2018-07-03 9:24 ` Peter Zijlstra
2018-07-03 9:21 ` Peter Zijlstra
2018-07-03 16:40 ` Andi Kleen
2018-07-03 17:02 ` Peter Zijlstra
2018-07-03 17:06 ` Andy Lutomirski
2018-07-03 17:10 ` Linus Torvalds
2018-07-03 17:26 ` Mathieu Desnoyers
2018-07-03 17:34 ` Peter Zijlstra
2018-07-03 17:38 ` Mathieu Desnoyers
2018-07-03 17:48 ` Peter Zijlstra
2018-07-03 17:58 ` Mathieu Desnoyers
2018-07-03 18:11 ` Peter Zijlstra
2018-07-03 18:15 ` Mathieu Desnoyers
2018-07-03 18:28 ` Peter Zijlstra
2018-07-03 18:41 ` Mathieu Desnoyers
2018-07-03 19:08 ` Peter Zijlstra
2018-07-03 17:59 ` Linus Torvalds
2018-07-03 18:09 ` Mathieu Desnoyers
2018-07-03 18:10 ` Peter Zijlstra
2018-07-03 0:19 ` Christopher Lameter
2018-07-03 0:23 ` Mathieu Desnoyers
2018-07-03 0:35 ` Christopher Lameter
2018-07-03 1:17 ` 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=CA+55aFxrX+wRoe+5HDaTrRXg1K-Qpks4jJ9Buc_OevoG8hoGFw@mail.gmail.com \
--to=torvalds@linux-foundation.org \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=bmaurer@fb.com \
--cc=boqun.feng@gmail.com \
--cc=catalin.marinas@arm.com \
--cc=cl@linux.com \
--cc=davejwatson@fb.com \
--cc=hpa@zytor.com \
--cc=josh@joshtriplett.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=luto@amacapital.net \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=pjt@google.com \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=will.deacon@arm.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).