This is the mail archive of the
mailing list for the glibc project.
Re: rseq/s390: choosing code signature
- From: Martin Schwidefsky <schwidefsky at de dot ibm dot com>
- To: Mathieu Desnoyers <mathieu dot desnoyers at efficios dot com>
- Cc: heiko carstens <heiko dot carstens at de dot ibm dot com>, gor <gor at linux dot ibm dot com>, libc-alpha <libc-alpha at sourceware dot org>, linux-kernel <linux-kernel at vger dot kernel dot org>, carlos <carlos at redhat dot com>
- Date: Wed, 10 Apr 2019 17:52:43 +0200
- Subject: Re: rseq/s390: choosing code signature
- References: <1779981820.2626.1554838342731.JavaMail.email@example.com> <20190410123258.37f182cf@mschwideX1> <514609006.3159.1554911439933.JavaMail.firstname.lastname@example.org>
On Wed, 10 Apr 2019 11:50:39 -0400 (EDT)
Mathieu Desnoyers <email@example.com> wrote:
> ----- On Apr 10, 2019, at 6:32 AM, schwidefsky firstname.lastname@example.org wrote:
> > On Tue, 9 Apr 2019 15:32:22 -0400 (EDT)
> > Mathieu Desnoyers <email@example.com> wrote:
> >> Hi,
> >> We are about to include the code signature required prior to restartable
> >> sequences abort handlers into glibc, which will make this ABI choice final.
> >> We need architecture maintainer input on that signature value.
> >> That code signature is placed before each abort handler, so the kernel can
> >> validate that it is indeed jumping to an abort handler (and not some
> >> arbitrary attacker-chosen code). The signature is never executed.
> >> The current discussion thread on the glibc mailing list leads us towards
> >> using a trap with uncommon immediate operand, which simplifies integration
> >> with disassemblers, emulators, makes it easier to debug if the control
> >> flow gets redirected there by mistake, and is nicer for some architecture's
> >> speculative execution.
> >> We can have different signatures for each sub-architecture, as long as they
> >> don't have to co-exist within the same process. We can special-case with
> >> #ifdef for each sub-architecture and endianness if need be. If the architecture
> >> has instruction set extensions that can co-exist with the architecture
> >> instruction set within the same process, we need to take into account to which
> >> instruction the chosen signature value would map (and possibly decide if we
> >> need to extend rseq to support many signatures).
> >> Here is an example of rseq signature definition template:
> >> /*
> >> * TODO: document trap instruction objdump output on each sub-architecture
> >> * instruction sets, as well as instruction set extensions.
> >> */
> >> #define RSEQ_SIG 0x########
> >> Ideally we'd need a patch on top of the Linux kernel
> >> tools/testing/selftests/rseq/rseq-s390.h file that updates
> >> the signature value, so I can then pick it up for the glibc
> >> patchset.
> > The trap4 instruction is a suitable one. The patch would look like this
> Great! I'm picking it up into my rseq tree if that's OK with you.
Just added the patch to s390/linux:features for the next merge window as well.
"Reality continues to ruin my life." - Calvin.