• Mathieu Desnoyers's avatar
    rseq/selftests: Fix Thumb mode build failure on arm32 · ee8a84c6
    Mathieu Desnoyers authored
    Using ".arm .inst" for the arm signature introduces build issues for
    programs compiled in Thumb mode because the assembler stays in the
    arm mode for the rest of the inline assembly. Revert to using a ".word"
    to express the signature as data instead.
    
    The choice of signature is a valid trap instruction on arm32 little
    endian, where both code and data are little endian.
    
    ARMv6+ big endian (BE8) generates mixed endianness code vs data:
    little-endian code and big-endian data. The data value of the signature
    needs to have its byte order reversed to generate the trap instruction.
    
    Prior to ARMv6, -mbig-endian generates big-endian code and data
    (which match), so the endianness of the data representation of the
    signature should not be reversed. However, the choice between BE32
    and BE8 is done by the linker, so we cannot know whether code and
    data endianness will be mixed before the linker is invoked. So rather
    than try to play tricks with the linker, the rseq signature is simply
    data (not a trap instruction) prior to ARMv6 on big endian. This is
    why the signature is expressed as data (.word) rather than as
    instruction (.inst) in assembler.
    
    Because a ".word" is used to emit the signature, it will be interpreted
    as a literal pool by a disassembler, not as an actual instruction.
    Considering that the signature is not meant to be executed except in
    scenarios where the program execution is completely bogus, this should
    not be an issue.
    Signed-off-by: default avatarMathieu Desnoyers <mathieu.desnoyers@efficios.com>
    Acked-by: default avatarWill Deacon <will.deacon@arm.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>
    CC: Carlos O'Donell <carlos@redhat.com>
    CC: Florian Weimer <fweimer@redhat.com>
    Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
    ee8a84c6
rseq-arm.h 22.9 KB