-
Notifications
You must be signed in to change notification settings - Fork 106
Valgrind segmentation fault
when trying to run binary
#1424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This could be bytecodealliance/wasmtime#7454. If it is indeed this issue, it is nothing to worry about. Basically the stack probing logic would attempt to write to stack pages to ensure the guard page isn't skipped in case of a stack overflow. Before the fix for that issue it would do the stack probe write before moving the stack pointer, which would result in a write beyond the "red zone". Anything below the red zone can be clobbered by the OS. In this case that would have been fine as it is never read back again, but valgrind doesn't know about this and thus will give an error just in case. The fix swaps the write and the stack pointer adjust such that it will never write beyond the red zone. A fix for bytecodealliance/wasmtime#7454 will land in the next Cranelift release which will be released at or after the 20th. |
Could you try the version at the artifacts section of https://github.com/rust-lang/rustc_codegen_cranelift/actions/runs/6834531001? This is a preliminary update to Cranelift 0.102 with the fixed I mentioned. I can't merge it before the official release though. |
Seems to works,
|
That is a rather large function which depends on inline asm: https://github.com/rust-lang/stdarch/blob/39e37792828c44641b6816ed7b8098b881627a72/crates/std_detect/src/detect/os/x86.rs#L28-L272 I think the origin is line 51 though, where In any case I can reproduce this using Dump of assembler code for function __inline_asm_rust_out__34c547e5261aeed8_cgu__0_n0:
0x000000000011e324 <+0>: push rbp
0x000000000011e325 <+1>: mov rbp,rsp
0x000000000011e328 <+4>: push rbx
0x000000000011e329 <+5>: mov rbx,rdi
0x000000000011e32c <+8>: mov rax,QWORD PTR [rbx]
0x000000000011e32f <+11>: mov rcx,QWORD PTR [rbx+0x8]
0x000000000011e333 <+15>: mov rsi,rbx
0x000000000011e336 <+18>: cpuid
0x000000000011e338 <+20>: xchg rbx,rsi
0x000000000011e33b <+23>: mov QWORD PTR [rbx+0x10],rsi
0x000000000011e33f <+27>: mov QWORD PTR [rbx],rax
0x000000000011e342 <+30>: mov QWORD PTR [rbx+0x8],rcx
0x000000000011e346 <+34>: mov QWORD PTR [rbx+0x18],rdx
0x000000000011e34a <+38>: pop rbx
0x000000000011e34b <+39>: pop rbp
0x000000000011e34c <+40>: ret
Dump of assembler code for function _ZN8rust_out4main17hdd9be5287a035326E:
0x000000000011e254 <+0>: push rbp
0x000000000011e255 <+1>: mov rbp,rsp
0x000000000011e258 <+4>: sub rsp,0x60
0x000000000011e25c <+8>: lea rsi,[rsp+0x40]
0x000000000011e261 <+13>: mov DWORD PTR [rsi],0x0
0x000000000011e267 <+19>: lea rdi,[rsp+0x48]
0x000000000011e26c <+24>: mov DWORD PTR [rdi],0x0
0x000000000011e272 <+30>: lea rdi,[rsp+0x40]
0x000000000011e277 <+35>: lea rax,[rip+0xa6] # 0x11e324 <__inline_asm_rust_out__34c547e5261aeed8_cgu__0_n0>
0x000000000011e27e <+42>: call rax
0x000000000011e280 <+44>: lea rcx,[rsp+0x50]
0x000000000011e285 <+49>: mov ecx,DWORD PTR [rcx]
0x000000000011e287 <+51>: lea rcx,[rsp+0x40]
0x000000000011e28c <+56>: mov ecx,DWORD PTR [rcx]
0x000000000011e28e <+58>: lea rdx,[rsp+0x48]
0x000000000011e293 <+63>: mov edx,DWORD PTR [rdx]
0x000000000011e295 <+65>: lea rdx,[rsp+0x58]
0x000000000011e29a <+70>: mov edx,DWORD PTR [rdx]
0x000000000011e29c <+72>: test ecx,ecx
=> 0x000000000011e29e <+74>: jne 0x11e31b <_ZN8rust_out4main17hdd9be5287a035326E+199>
[...] |
Looks that valgrind again not works for me and I have this message
Also I have logs polluted by this messages(I removed entire target folder, but still have such message)
With |
valgrind 3.21.0 - from snap
when using valgrind with default cargo version I not have any problem, but here with cranefild I have this crash
The text was updated successfully, but these errors were encountered: