Thread (11 messages) 11 messages, 6 authors, 2019-04-18

Re: [PATCH 1/4] glibc: Perform rseq(2) registration at C startup and thread creation (v7)

flat view

From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Date: 2019-04-09 16:34:02
Also in: lkml

----- On Apr 8, 2019, at 5:45 PM, Carlos O'Donell codonell@redhat.com wrote:
On 4/8/19 3:20 PM, Tulio Magno Quites Machado Filho wrote:
quoted
Carlos O'Donell [off-list ref] writes:
quoted
On 4/5/19 5:16 AM, Florian Weimer wrote:
quoted
* Carlos O'Donell:
quoted
It is valuable that it be a trap, particularly for constant pools because
it means that a jump into the constant pool will trap.
Sorry, I don't understand why this matters in this context.  Would you
please elaborate?
Sorry, I wasn't very clear.

My point is only that any accidental jumps, either with off-by-one (like you
fixed in gcc/glibc's signal unwinding most recently), result in a process fault
rather than executing RSEQ_SIG as a valid instruction *and then* continuing
onwards to the handler.

A process fault is achieved either by a trap, or an invalid instruction, or
a privileged insn (like suggested for MIPS in this thread).
In that case, mtmsr (Move to Machine State Register) seems a good candidate.

mtmsr is available both on 32 and 64 bits since their first implementations.

It's a privileged instruction and should never appear in userspace
code (causes SIGILL).

Any comments?
 
That seems good to me.

Mathieu,

What's required to move this forward for POWER?
First, we need to decide whether we need rseq to support more than
one signature per process to cover the VLE extension. If so, we'd
need to extend rseq with a new flag for future kernels.

Then, ideally, we'd need a patch on top of the Linux kernel
tools/testing/selftests/rseq/rseq-ppc.h file that updates
the signature value. I think the current discussion leads us
towards a trap:

/*
 * TODO: document instruction objdump output on each architecture and VLE
 * instruction sets.
 */
#define RSEQ_SIG 0x0fe5000b

Should we do anything specific for big/little endian ? Is the byte order
of the instruction encoding the same as data ?

Thanks,

Mathieu

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help