Skip to content

[BOLT][AArch64] Application crash with segment fault after bolt instrument sometimes #165664

@mrzhouyh

Description

@mrzhouyh

My application crash with segment fault after BOLT instrument on arm64 ( Kunpeng 920 5250 acctually ), this issue happens somtimes, not always. And it never appear on x86.

the intrument command is :
llvm-bolt $bin -o ${BOLTDIR}/${filename}.inst -instrument --instrumentation-file=${BOLTDIR}/${filename}.fdata

After check the core file, it seems that segment fault raised when TLS accessed like:
`__thread int hg_trigger_success = 0;

void func() {
/** do something /
hg_trigger_success = 1; /
* segment fault here*/
/** do something */
}
`

0x0000ffffbefa96f4 <+1396>: msr nzcv, x1
0x0000ffffbefa96f8 <+1400>: ldp x0, x1, [sp], #16
0x0000ffffbefa96fc <+1404>: b 0xffffbefa9778 <crt_hg_progress+1528>
0x0000ffffbefa9700 <+1408>: cbnz w27, 0xffffbefaa5a4 <crt_hg_progress+5156>
0x0000ffffbefa9704 <+1412>: mrs x16, tpidr_el0
0x0000ffffbefa9708 <+1416>: adrp x0, 0xffffbea90000 [email protected]
0x0000ffffbefa970c <+1420>: ldr x3, [x0, #3904]
0x0000ffffbefa9710 <+1424>: add x0, x0, #0xf40
0x0000ffffbefa9714 <+1428>: stp x0, x1, [sp, #-16]!
0x0000ffffbefa9718 <+1432>: mov x0, x3
0x0000ffffbefa971c <+1436>: movk x1, #0x0, lsl #48
0x0000ffffbefa9720 <+1440>: movk x1, #0x0, lsl #32
0x0000ffffbefa9724 <+1444>: movk x1, #0x0, lsl #16
0x0000ffffbefa9728 <+1448>: movk x1, #0x264
0x0000ffffbefa972c <+1452>: stp x0, x1, [sp, #-16]!
0x0000ffffbefa9730 <+1456>: adrp x0, 0xffffbf22c000 <swim_updates_parse+18100>
--Type for more, q to quit, c to continue without paging--
0x0000ffffbefa9734 <+1460>: add x0, x0, #0x594
0x0000ffffbefa9738 <+1464>: blr x0
0x0000ffffbefa973c <+1468>: mov w17, #0x1 // #1
0x0000ffffbefa9740 <+1472>: subs w26, w26, w7
=> 0x0000ffffbefa9744 <+1476>: str w17, [x16, x0]
0x0000ffffbefa9748 <+1480>: b.eq 0xffffbefa9778 <crt_hg_progress+1528> // b.none
0x0000ffffbefa974c <+1484>: stp x0, x1, [sp, #-16]!
0x0000ffffbefa9750 <+1488>: mrs x1, nzcv

Is here anybody know why this issus happen, and how to fix it?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions