[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFwJWxsE_LL=-8WgB7uH_mYeMSu=boWF4N5KdOW673g4hA@mail.gmail.com>
Date: Fri, 29 Jun 2018 08:54:05 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc: Andy Lutomirski <luto@...capital.net>,
Andrew Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux API <linux-api@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Paul McKenney <paulmck@...ux.vnet.ibm.com>,
Boqun Feng <boqun.feng@...il.com>,
Dave Watson <davejwatson@...com>, Paul Turner <pjt@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Russell King - ARM Linux <linux@....linux.org.uk>,
Ingo Molnar <mingo@...hat.com>, Peter Anvin <hpa@...or.com>,
Andi Kleen <andi@...stfloor.org>,
Christoph Lameter <cl@...ux.com>, Ben Maurer <bmaurer@...com>,
Steven Rostedt <rostedt@...dmis.org>,
Josh Triplett <josh@...htriplett.org>,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will.deacon@....com>,
Michael Kerrisk <mtk.manpages@...il.com>,
Joel Fernandes <joelaf@...gle.com>
Subject: Re: [RFC PATCH for 4.18 1/2] rseq: validate rseq_cs fields are < TASK_SIZE
On Fri, Jun 29, 2018 at 8:27 AM Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> You simply can't have it both ways.
Put another way.
This is ok in the native path:
if ((unsigned long) rseq_cs->abort_ip != rseq_cs->abort_ip)
return -EINVAL;
because it's checking that the value fits in the native register size
(and it also ends up being a no-op if the native size is the same size
as abort_ip).
And this is very much ok in a compat syscall:
if (rseq_cs->abort_ip & ~(unsigned long)-1u)
return -EINVAL;
because it's checking that the pointer doesn't have (invalid in
compat) high bits set.
But it is NOT OK to say "the rseq system call doesn't have any compat
syscall, but we'll do that compat check in the native case, because we
worry about compat issues".
See what I'm saying? Either you worry about compat issues (and have a
compat syscall), or you don't.
The whole "let's not do a compat syscall, but then check compat issues
at run-time in the native system call because compat processes will
use it" is braindamage.
Linus
Powered by blists - more mailing lists