-
Notifications
You must be signed in to change notification settings - Fork 13k
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
faults and weird behavior on armv5te #64126
Comments
I was able to reproduce the issue with rustc 1.31.1 and 1.37.0. For 1.37.0 and 1.39.0 the issues seems to be fixed. |
I managed to reproduce this specific issue without arc-swap: https://github.com/M1cha/rust_armfault/tree/atomicptr basically, if you load from a global static AtomicPtr which is not inside the current crate(it has to be in an external crate), then LTO links against the wrong memory location. |
I tried to reproduce this with the latest nightly but wasn't able to. Can you check on your end to see if this issue is fixed? |
I can't reproduce it anymore either. My hope is that it actually got fixed and it's not just that it coincidentally stopped causing a crash. |
I'm going to close this issue unless someone can reproduce this with the latest compiler. |
I've recently encountered a similar problem. I use cargo-xbuild to build my project. The object file for compiler_builtins contains multiple such occurrences.
There are 72 cases of that happening in the object file. EDIT: Note, I did retry this again with a custom armv6kz-none-eabihf target, I did not encounter any issues there, so this appears to be a problem limited to armv5te. I tested following two targets which are certainly affected (likely even more): |
That's a different issue: rust-lang/compiler-builtins#420 |
I don't see how that's a different issue. |
I'm trying to use rust binaries on an armv5te gateway using yocto(thud, meta-atmel).
Depending on the configuration(rust-version, target-flags, lto, optimization) I have anything from a (luckily) working binary over wrong logic-level behavior to segmentation faults.
During runtime, these problems are deterministic and are introduced during compile-time.
I've uploaded a minmial example of one of these symptoms for you to be able to reproduce the problem: https://github.com/M1cha/rust_armfault/tree/arcswap
config:
stable-x86_64-unknown-linux-gnu
,rustc 1.31.1 (b6c32da9b 2018-12-18)
)1:1.24.0.r6.gafaf7b9a-1
~/.cargo/config
cargo build --release --target armv5te-unknown-linux-gnueabi
This specific fault only occurs with LTO enabled, during optimization levels 2 and 3.
To be clear, unless I'm fighting multiple bugs at once, this bug is NOT caused by LTO, it just happens to occur in that config. I have other symptoms which occur without LTO and optimization level 1, but I can't reproduce them outside of my yocto environment.(e.g. a segfault during
regex::Regex::new
).This is the call-stack during the fault:
registers:
user_debug kernel log:
instructions at pc, pc+4, pc+8:
At first glance this looks like a fault-on-read but due to how
__kuser_cmpxchg
is implemented it actually faults at the write(0xffff0fc8), then jumps back to 0xffff0fc0 and then informs gdb via ptrace.The address it tries to write to is
0x45acdc
which maps to0x5acdc
inside the elf binary.This area is part of the rodata section:
[15] .rodata PROGBITS 0005ab80 05ab80 00616c 00 A 0 0 64
There's no symbol at that location though.
I hope that this helps you to track down the bug because this keeps me from using rust on this architecture.
The text was updated successfully, but these errors were encountered: