• Mathieu Desnoyers's avatar
    rseq/selftests: arm: use udf instruction for RSEQ_SIG · 2b845d4b
    Mathieu Desnoyers authored
    Use udf as the guard instruction for the restartable sequence abort
    handler.
    
    Previously, the chosen signature was not a valid instruction, based
    on the assumption that it could always sit in a literal pool. However,
    there are compilation environments in which literal pools are not
    available, for instance execute-only code. Therefore, we need to
    choose a signature value that is also a valid instruction.
    
    Handle compiling with -mbig-endian on ARMv6+, which generates binaries
    with mixed code vs data endianness (little endian code, big endian
    data).
    
    Else mismatch between code endianness for the generated signatures and
    data endianness for the RSEQ_SIG parameter passed to the rseq
    registration will trigger application segmentation faults when the
    kernel try to abort rseq critical sections.
    
    Prior to ARMv6, -mbig-endian generates big-endian code and data, so
    endianness should not be reversed in that case.
    Signed-off-by: default avatarMathieu Desnoyers <mathieu.desnoyers@efficios.com>
    CC: Peter Zijlstra <peterz@infradead.org>
    CC: Thomas Gleixner <tglx@linutronix.de>
    CC: Joel Fernandes <joelaf@google.com>
    CC: Catalin Marinas <catalin.marinas@arm.com>
    CC: Dave Watson <davejwatson@fb.com>
    CC: Will Deacon <will.deacon@arm.com>
    CC: Shuah Khan <shuah@kernel.org>
    CC: Andi Kleen <andi@firstfloor.org>
    CC: linux-kselftest@vger.kernel.org
    CC: "H . Peter Anvin" <hpa@zytor.com>
    CC: Chris Lameter <cl@linux.com>
    CC: Russell King <linux@arm.linux.org.uk>
    CC: Michael Kerrisk <mtk.manpages@gmail.com>
    CC: "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
    CC: Paul Turner <pjt@google.com>
    CC: Boqun Feng <boqun.feng@gmail.com>
    CC: Josh Triplett <josh@joshtriplett.org>
    CC: Steven Rostedt <rostedt@goodmis.org>
    CC: Ben Maurer <bmaurer@fb.com>
    CC: linux-api@vger.kernel.org
    CC: Andy Lutomirski <luto@amacapital.net>
    CC: Andrew Morton <akpm@linux-foundation.org>
    CC: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
    2b845d4b
rseq-arm.h 22.6 KB