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

MemoryMap fails on ARM #25538

Closed
geraldstanje opened this issue May 17, 2015 · 2 comments
Closed

MemoryMap fails on ARM #25538

geraldstanje opened this issue May 17, 2015 · 2 comments

Comments

@geraldstanje
Copy link

Hi,

I ported this c app (http://ideone.com/AbImAr) to rust but face an issue with MemoryMap.

The rust app is cross compiled on my ubuntu linux for the ARM:

# file /sbin/init
/sbin/init: ELF 32-bit LSB  shared object, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=289a0061854bb8d2f7ed8286c0a18aa1207141a5, stripped

Rust was built from source according to https://github.com/japaric/ruststrap/blob/master/1-how-to-cross-compile.md

The rust app is built using cargo:

$ rustc --version
rustc 1.0.0-dev (a59de37e9 2015-05-13) (built 2015-5-14)

$ cargo build --target=arm-unkown-linux-gnuabihf

The rust app crashes without any error and cuts off my ssh connection to the device...
what happens could be:
in best case the kernel crashes, in worst case a disk buffer is overwritten and face a silent filesystem corruption...

Here the code code of the rust app (which crashes when executing the unsafe part):
http://is.gd/PT0cwM

Gdb output:
why does it report "Cannot access memory"? Can i trust this info to be correct?

let mmap = MemoryMap::new(size, mmap_opts).unwrap();
(gdb) next
42      let data = mmap.data();
(gdb) print mmap
$1 = {data = 0xb5c00000 <error: Cannot access memory at address 0xb5c00000>, len = 8388608, kind = {{RUST$ENUM$DISR = MapFile, __0 = 0x0}, {
      RUST$ENUM$DISR = MapFile}}}

Strace for the rust app (to get the strace, the unsafe part of the code was disabled):
http://ideone.com/hNIYMw

@klutzy
Copy link
Contributor

klutzy commented May 17, 2015

MemoryMap is no longer a part of standard library now. According to crates.io info, you should ask https://github.com/rbranson/rust-mmap.

@geraldstanje
Copy link
Author

ok. i posted it there: rbranson/rust-mmap#4 ...can you comment?

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

No branches or pull requests

3 participants