[llvm-bugs] [Bug 46427] New: Hardware Asan generating illegal instruction

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 23 05:07:42 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46427

            Bug ID: 46427
           Summary: Hardware Asan generating illegal instruction
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: derrick.mckee at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    peter at pcc.me.uk, richard-llvm at metafoo.co.uk

Created attachment 23641
  --> https://bugs.llvm.org/attachment.cgi?id=23641&action=edit
Test program that generates illegal instruction

A simple Hello World program generates an illegal instruction when using the
aarch64-linux-gnu toolchain and hardware address sanitizer.  The cause of this
issue is detailed at https://reviews.llvm.org/D65857#1621335, and can be fixed
by adding -fuse-ld=lld.

How to recreate:

# llvm-project/build-10.x/install/bin/clang --version
clang version 10.0.1 (git at github.com:llvm/llvm-project.git
a634a80615b1e012f1a61aa0cd1e2e67ef77d0bd)
Target: x86_64-unknown-linux-gnu
Thread model: posix

llvm-project/build-10.x/install/bin/clang -o test --target=aarch64-linux-gnu
-march=armv8.5-a -fsanitize=hwaddress --sysroot=/usr/aarch64-linux-gnu/
-L/usr/lib/gcc/aarch64-linux-gnu/10.1.0/ -g test.c

llvm-project/build-10.x/install/bin/llvm-objdump -d
--disassemble-functions=main test

Expected output: A valid disassembly of the test binary

Actual output: See instruction 2d51c below.

000000000002d4c0 main:
   2d4c0: ff c3 00 d1                      sub    sp, sp, #48
   2d4c4: fd 7b 02 a9                      stp    x29, x30, [sp, #32]
   2d4c8: fd 83 00 91                      add    x29, sp, #32
   2d4cc: 08 01 00 d0                      adrp    x8, #139264
   2d4d0: 08 49 47 f9                      ldr    x8, [x8, #3728]
   2d4d4: 49 d0 3b d5                      mrs    x9, TPIDR_EL0
   2d4d8: 28 69 68 f8                      ldr    x8, [x9, x8]
   2d4dc: 08 7d 40 b2                      orr    x8, x8, #0xffffffff
   2d4e0: 08 05 00 91                      add    x8, x8, #1
   2d4e4: a2 13 00 d1                      sub    x2, x29, #4
   2d4e8: e9 03 08 aa                      mov    x9, x8
   2d4ec: df 64 ff 97                      bl    #-158852
<__hwasan_check_x2_18_short>
   2d4f0: ea 03 1f 2a                      mov    w10, wzr
   2d4f4: aa c3 1f b8                      stur    w10, [x29, #-4]
   2d4f8: a2 23 00 d1                      sub    x2, x29, #8
   2d4fc: e9 03 08 aa                      mov    x9, x8
   2d500: da 64 ff 97                      bl    #-158872
<__hwasan_check_x2_18_short>
   2d504: a0 83 1f b8                      stur    w0, [x29, #-8]
   2d508: e2 43 00 91                      add    x2, sp, #16
   2d50c: e9 03 08 aa                      mov    x9, x8
   2d510: ec 64 ff 97                      bl    #-158800
<__hwasan_check_x2_19_short>
   2d514: e1 0b 00 f9                      str    x1, [sp, #16]
   2d518: 40 00 00 d0                      adrp    x0, #40960
   2d51c: e0 ff e5 b2                      <unknown>
   2d520: 00 40 35 91                      add    x0, x0, #3408
   2d524: ea 0f 00 b9                      str    w10, [sp, #12]
   2d528: c2 64 ff 97                      bl    #-158968 <printf at plt>
   2d52c: ea 0f 40 b9                      ldr    w10, [sp, #12]
   2d530: e0 0b 00 b9                      str    w0, [sp, #8]
   2d534: e0 03 0a 2a                      mov    w0, w10
   2d538: fd 7b 42 a9                      ldp    x29, x30, [sp, #32]
   2d53c: ff c3 00 91                      add    sp, sp, #48
   2d540: c0 03 5f d6                      ret

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200623/990ba8b9/attachment-0001.html>


More information about the llvm-bugs mailing list