-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
Hello,
I encounter a crash on a x86_64 machine. It looks like the rdx register is dereferenced while being invalid:
Program received signal SIGSEGV, Segmentation fault
0x000055555558aa2c in _ ()
(gdb) x/6i $pc-20
0x55555558aa18 <_+56>: rdtsc
0x55555558aa1a <_+58>: shl rdx,0x20
0x55555558aa1e <_+62>: or rax,rdx
0x55555558aa21 <_+65>: mov QWORD PTR [rcx],0x1
0x55555558aa28 <_+72>: mov QWORD PTR [rcx+0x8],rax
=> 0x55555558aa2c <_+76>: movzx eax,BYTE PTR [rdx+0x14]
(gdb) i r $rdx
rdx 0x227bd00000000 606642655723520
I guess the reason is rdx is not marked as an out register in start() and stop() functions, and the compiler assumes it isn't modified.
Suggested fix (untested): add out("rdx") _ to the asm! macros if you don't want to rely on core::arch::x86_64::_rdtsc.
Metadata
Metadata
Assignees
Labels
No labels