Skip to content
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

Fix corruption when running cargo test on ARM64 #693

Closed
wants to merge 1 commit into from

Conversation

jiangliu
Copy link
Contributor

Run cargo test on ARM64 will encounter following corruption, which is caused by unaligned memory access. So enable the test for x86_64 only.

thread 'coredump::test::test_coredump' panicked at src/coredump.rs:94:30: misaligned pointer dereference: address must be a multiple of 0x8 but is 0xffffa6ba0334 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace thread caused non-unwinding panic. aborting.
error: test failed, to rerun pass --lib

Caused by:
process didn't exit successfully: /dragonball/py-spy.git/target/debug/deps/py_spy-1a1c8047c3d9ee13 (signal: 6, SIGABRT: process abort signal)

Run `cargo test` on ARM64 will encounter following corruption, which is
caused by unaligned memory access. So enable the test for x86_64 only.

thread 'coredump::test::test_coredump' panicked at src/coredump.rs:94:30:
misaligned pointer dereference: address must be a multiple of 0x8 but is 0xffffa6ba0334
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread caused non-unwinding panic. aborting.
error: test failed, to rerun pass `--lib`

Caused by:
  process didn't exit successfully: `/dragonball/py-spy.git/target/debug/deps/py_spy-1a1c8047c3d9ee13` (signal: 6, SIGABRT: process abort signal)

Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
#[cfg(test)]
mod test {
use super::*;
use py_spy_testdata::get_coredump_path;

#[cfg(target_pointer_width = "64")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this inner cfg insufficient?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ARM64 will also match this cfg, but it seems that the coredump file is generated from x86 thus cause unaligned access on ARM64.

@benfred
Copy link
Owner

benfred commented Oct 12, 2024

Does #657 fix the issue for you?

@jiangliu
Copy link
Contributor Author

Does #657 fix the issue for you?

Yeah, missed that PR. I have tried #657 and it does fix the invalid memory access issue.
BTW, it would be great to generate multiple test coredump files for different archs in crate py-spy-test:)

@jiangliu
Copy link
Contributor Author

Prefer #657 instead of this one.

@jiangliu jiangliu closed this Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants