You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Segfault during tests on rust 1.27.x on macOS (SIGSEGV: invalid memory reference) #52390
I can't reproduce on macOS or Ubuntu; what version of macOS do you have? Can you get a backtrace on the segfault? Is the segfault persistent, or is it transient?
I am on OS X 10.11.6. Running RUST_BACKTRACE=1 cargo test I get nothing more than the trace I’ve put in my first message. The segfault is persistent, at least on 100% of the 10-20 runs I’ve done.
You'll need to run with something like lldb or gdb to get the segfault or look for a core dump (I believe those are generated on macOS, though you may need to do something to get them).
I am testing on 10.13.5 so this is possibly related to #51828, though that claims to only be a problem on 10.10.
I do get repeated assertion failures in makes_a_passphrase_with_special_char, but even those don't happen on every run.
@Mark-Simulacrum Regarding this, I think it is due to the test itself lacking for a check. If the special char is a digit and inserted in a digit, it can match a dictionary word and the test fails. I have not yet figured how to write a better test to catch this. The problem seems to occur very early in the process, and in returns_an_error_if_number_of_words_is_zero.
Thanks @ejpcmac! As the debugger error shows, the segfault is indeed caused by unaligned TLS access (movaps %xmm0, (%rax) but %rax is not 16-byte-aligned).
As mentioned in the issue there's no bug in 1.28-beta. We may workaround in 1.27 by forcing a link_section in the thread_local! macro (not tested)...
... but this won't affect other #[thread_local] variables if existing (and also bloats the executable size since it can't be placed in the BSS), and I'm not sure if this worth a 1.27.3.
I don't think it's worth 1.27.3. We already decided that we're not going to backport the original TLS patch -- and 1.28 will be out in two weeks anyway.
visiting for triage. I concur with @Mark-Simulacrum 's assessment. Only question is whether to close this bug today, or close it after 1.28 is released.
Activity
Mark-Simulacrum commentedon Jul 14, 2018
I can't reproduce on macOS or Ubuntu; what version of macOS do you have? Can you get a backtrace on the segfault? Is the segfault persistent, or is it transient?
ejpcmac commentedon Jul 14, 2018
I am on OS X 10.11.6. Running
RUST_BACKTRACE=1 cargo testI get nothing more than the trace I’ve put in my first message. The segfault is persistent, at least on 100% of the 10-20 runs I’ve done.Mark-Simulacrum commentedon Jul 14, 2018
You'll need to run with something like lldb or gdb to get the segfault or look for a core dump (I believe those are generated on macOS, though you may need to do something to get them).
I am testing on 10.13.5 so this is possibly related to #51828, though that claims to only be a problem on 10.10.
kennytm commentedon Jul 14, 2018
Could you run
target/debug/deps/diceware-c7f6b180dd3b52c6in lldb and get the stack trace from there?Mark-Simulacrum commentedon Jul 14, 2018
I do get repeated assertion failures in makes_a_passphrase_with_special_char, but even those don't happen on every run.
ejpcmac commentedon Jul 14, 2018
Running in lldb I get:
Edit note: running multiple times gets to the very same failure.
ejpcmac commentedon Jul 14, 2018
@Mark-Simulacrum Regarding this, I think it is due to the test itself lacking for a check. If the special char is a digit and inserted in a digit, it can match a dictionary word and the test fails. I have not yet figured how to write a better test to catch this. The problem seems to occur very early in the process, and in
returns_an_error_if_number_of_words_is_zero.Mark-Simulacrum commentedon Jul 15, 2018
Can you run
whereor maybebacktracein lldb to get the full trace?kennytm commentedon Jul 15, 2018
ptr.rs:237is insideswap_nonoverlapping_bytes(). I'm pretty sure it is the same TLS issue, though I don't know why it affects 10.11.ejpcmac commentedon Jul 15, 2018
@Mark-Simulacrum Sorry for the delay, it was already late here in Europe.
Follows a new run with its backtrace:
pnkfelix commentedon Jul 19, 2018
tagging as T-compiler under assumption that this is in our wheel house, at least until we seen evidence to the contrary
ejpcmac commentedon Jul 19, 2018
If I can help in some way please let me know.
kennytm commentedon Jul 19, 2018
@ejpcmac In the debugger when it crashed, could you execute
disasandreg readto show the disassembly and registry dump?ejpcmac commentedon Jul 19, 2018
@kennytm For sure. I’ll do it as soon as I’m home.
ejpcmac commentedon Jul 19, 2018
@kennytm Here I am:
kennytm commentedon Jul 19, 2018
Thanks @ejpcmac! As the debugger error shows, the segfault is indeed caused by unaligned TLS access (
movaps %xmm0, (%rax)but%raxis not 16-byte-aligned).As mentioned in the issue there's no bug in 1.28-beta. We may workaround in 1.27 by forcing a
link_sectionin thethread_local!macro (not tested)...... but this won't affect other
#[thread_local]variables if existing (and also bloats the executable size since it can't be placed in the BSS), and I'm not sure if this worth a 1.27.3.Mark-Simulacrum commentedon Jul 19, 2018
I don't think it's worth 1.27.3. We already decided that we're not going to backport the original TLS patch -- and 1.28 will be out in two weeks anyway.
pnkfelix commentedon Jul 26, 2018
visiting for triage. I concur with @Mark-Simulacrum 's assessment. Only question is whether to close this bug today, or close it after 1.28 is released.
nikomatsakis commentedon Aug 9, 2018
Visiting in compiler team meeting. Inclination is to close now in favor of using 1.28 (released on Aug 2)