[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrX4dzY_kyZmqR+srKZf7vVYzODH5i9bguFAzdm0dcU3ZQ@mail.gmail.com>
Date: Tue, 14 Nov 2017 20:12:23 -0800
From: Andy Lutomirski <luto@...capital.net>
To: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <peterz@...radead.org>,
"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
Boqun Feng <boqun.feng@...il.com>,
Dave Watson <davejwatson@...com>,
linux-kernel <linux-kernel@...r.kernel.org>,
linux-api <linux-api@...r.kernel.org>,
Paul Turner <pjt@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Russell King <linux@....linux.org.uk>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>,
"H. Peter Anvin" <hpa@...or.com>, Andrew Hunter <ahh@...gle.com>,
Andi Kleen <andi@...stfloor.org>, Chris Lameter <cl@...ux.com>,
Ben Maurer <bmaurer@...com>, 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>
Subject: Re: [RFC PATCH for 4.15 00/24] Restartable sequences and CPU op
vector v11
> On Nov 14, 2017, at 1:32 PM, Mathieu Desnoyers <mathieu.desnoyers@...icios.com> wrote:
>
> ----- On Nov 14, 2017, at 4:15 PM, Andy Lutomirski luto@...capital.net wrote:
>
>
> One thing I kept however that diverge from your recommendation is the
> "sign" parameter to the rseq syscall. I prefer this flexible
> approach to a hardcoded signature value. We never know when we may
> need to randomize or change this in the future.
>
> Regarding abort target signature the vs x86 disassemblers, I used a
> 5-byte no-op on x86 32/64:
>
> x86-32: nopl <sig>
> x86-64: nopl <sig>(%rip)
I still don't see how this can possibly work well with libraries. If
glibc or whatever issues the syscall and registers some signature,
that signature *must* match the expectation of all libraries used in
that thread or it's not going to work. I can see two reasonable ways
to handle it:
1. The signature is just a well-known constant. If you have an rseq
abort landing site, you end up with something like:
nopl $11223344(%rip)
landing_site:
or whatever the constant is.
2. The signature varies depending on the rseq_cs in use. So you get:
static struct rseq_cs this_cs = {
.signature = 0x55667788;
...
};
and then the abort landing site has:
nopl $11223344(%rip)
nopl $55667788(%rax)
landing_site:
The former is a bit easier to deal with. The latter has the nice
property that you can't subvert one rseq_cs to land somewhere else,
but it's not clear to me how what actual attack this prevents, so I
think I prefer #1. I just think that your variant is asking for
trouble down the road with incompatible userspace.
--Andy
Powered by blists - more mailing lists