Skip to content

Commit

Permalink
Fix broken test after toolchain update
Browse files Browse the repository at this point in the history
Summary: These tests did unaligned reads/writes, which can produce a `SIGABRT` instead of a `SIGSEGV`. Simply align the reads/writes to 8 bytes to fix the tests.

Reviewed By: JakobDegen, dtolnay

Differential Revision: D53597637

fbshipit-source-id: e2ede420b6249223569af6d89d43a47438967ced
  • Loading branch information
jasonwhite authored and facebook-github-bot committed Feb 9, 2024
1 parent 06f05e1 commit 17e8f64
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/basics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,8 @@ fn i_should_segfault() {
use reverie_ptrace::testing::test_fn;
let (output, _) = test_fn::<NoopTool, _>(|| {
unsafe {
let invalid_ptr = 0x5u64 as *mut u64;
invalid_ptr.write(0xdeadbeefu64);
let invalid_ptr = 0x8u64 as *mut u64;
invalid_ptr.write_volatile(0xdeadbeefu64);
};
})
.unwrap();
Expand All @@ -246,8 +246,8 @@ fn i_should_segfault_2() {
use reverie_ptrace::testing::test_fn;

pub fn do_segfault() {
let invalid_ptr = 0x1234 as *const usize;
let result = unsafe { invalid_ptr.read() };
let invalid_ptr = 0x8u64 as *const usize;
let result = unsafe { invalid_ptr.read_volatile() };
// Print so the above doesn't get optimized out. We will never get here
// because the above segfaults.
println!("{}", result);
Expand Down

0 comments on commit 17e8f64

Please sign in to comment.