[llvm-dev] Hardware ASan Generating Unknown Instruction
Peter Collingbourne via llvm-dev
llvm-dev at lists.llvm.org
Mon Jun 22 13:59:58 PDT 2020
Thanks for the confirmation. From the assembly that was sent on the other
branch of the thread:
> .set .L.str, .L.str.hwasan-3458764513820540928
-3458764513820540928 = 0xd0 << 56
i.e. a "negative" tag.
So this appears to be the issue exactly.
Peter
On Mon, Jun 22, 2020 at 1:55 PM Derrick McKee <derrick.mckee at gmail.com>
wrote:
> Using lld fixes this issue.
>
> On Mon, Jun 22, 2020 at 4:51 PM Peter Collingbourne <peter at pcc.me.uk>
> wrote:
> >
> > I suspect that this is hitting the issue that I mentioned here:
> > https://reviews.llvm.org/D65857#1621335
> >
> > We may need to do what I suggested there and restrict global tag entropy
> on non-Android Linux to 7 bits. You can try working around this issue for
> now by using lld as the linker (-fuse-ld=lld).
> >
> > Peter
> >
> > On Mon, Jun 22, 2020 at 1:37 PM Mitch Phillips via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
> >>
> >> Hi Derrick,
> >>
> >> Can you send through `test.c`? What does clang's assembly say
> (`path/to/compiled/clang --target=aarch64-linux-gnu -march=armv8.5-a
> -fsanitize=hwaddress -S test.c; cat test.s`)?
> >>
> >> - Mitch
> >>
> >> On Mon, Jun 22, 2020 at 12:04 PM Derrick McKee via llvm-dev <
> llvm-dev at lists.llvm.org> wrote:
> >>>
> >>> Hi,
> >>>
> >>> I am trying to execute a simple hello world program compiled like so:
> >>>
> >>> path/to/compiled/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
> >>>
> >>> However, when I look at the disassembly, there is an unknown
> >>> instruction listed at 0x2d51c:
> >>>
> >>> 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
> >>>
> >>>
> >>> Am I compiling the program incorrectly? For reference, here's my
> clang version
> >>>
> >>> # llvm-project/build-10.x/install/bin/clang --version
> >>> [1]
> >>> clang version 10.0.1 (git at github.com:llvm/llvm-project.git
> >>> a634a80615b1e012f1a61aa0cd1e2e67ef77d0bd)
> >>> Target: x86_64-unknown-linux-gnu
> >>> Thread model: posix
> >>>
> >>> --
> >>> Derrick McKee
> >>> Phone: (703) 957-9362
> >>> Email: derrick.mckee at gmail.com
> >>> _______________________________________________
> >>> LLVM Developers mailing list
> >>> llvm-dev at lists.llvm.org
> >>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> >>
> >> _______________________________________________
> >> LLVM Developers mailing list
> >> llvm-dev at lists.llvm.org
> >> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
> >
> >
> >
> > --
> > --
> > Peter
>
>
>
> --
> Derrick McKee
> Phone: (703) 957-9362
> Email: derrick.mckee at gmail.com
>
--
--
Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200622/0c8f22ac/attachment.html>
More information about the llvm-dev
mailing list