Comments (3)
A little update just to let you know that a fix for the reported bug was already committed to master:
- https://git.qemu.org/?p=qemu.git;a=commit;h=38138fab93584ad3560ddfcd70efbd5bb6b4a6f0
- https://git.qemu.org/?p=qemu.git;a=commit;h=28cbb997d66e4d1904a231bef1ce15c2cbb6bf73
- https://wiki.qemu.org/ChangeLog/3.0#User-mode_emulation
from mambo.
Last time I've tried to run MAMBO using qemu user mode emulation, I've ran into numerous qemu bugs. Use native hardware or system mode emulation. The assertion at elf_loader/elf_loader.c:127
should never fail when running natively. I'm curious to see what's causing it to fail in qemu, but I don't have a debug build available at the moment.
$ ./test/mmap_munmap
mmap_munmap: mmap_munmap.c:33: main: Assertion `alloc == MAP_FAILED' failed.
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted (core dumped)
That's a qemu bug. Please report it to them. According to the mmap
manual:
If len is zero, mmap() shall fail and no mapping shall be established.
from mambo.
Indeed, I stripped down mmap_munmap
to:
#include <stdlib.h>
#include <assert.h>
#include <sys/mman.h>
#include <errno.h>
#include <stdio.h>
int main() {
// Failing allocation
void *alloc = mmap(NULL, 0, PROT_EXEC | PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
printf("alloc: %d\n", alloc);
printf("MAP_FAILED: %d\n", MAP_FAILED);
printf("errno: %d\n", errno);
assert(alloc == MAP_FAILED);
return 0;
}
I cross compiled in x86_64:
aarch64-linux-gnu-gcc -static -std=gnu99 -lpthread test/mmap_qemu.c -o mmap_qemu
This is the output in x86_64:
$ ./mmap_qemu
alloc: 0
MAP_FAILED: -1
errno: 0
mmap_qemu: test/mmap_qemu.c:15: main: Assertion `alloc == MAP_FAILED' failed.
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted (core dumped)
This is the output in a Jetson TX1:
$ ./mmap_qemu
alloc: -1
MAP_FAILED: -1
errno: 22
So, as you said, qemu is not handling mmap properly. It is returning a success (0
) when it should be returning a failure (-1
, MAP_FAILED
). I reported it to them: https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1783362
I'm closing this for now. Thanks!
from mambo.
Related Issues (20)
- Building on Android HOT 15
- drcov plugin
- Incorrect pcrel address calculation in Thumb HOT 4
- Segmentation fault on RPi 3 B (2018-11-13-raspbian-stretch) HOT 3
- Assertion error and Segmentation fault on docker containers HOT 2
- thumb_load_store_single_reg_imm12_32 caculate wrong instruction whem imm12 is less than 0x40 HOT 4
- Error compiling - cannot find pie/pie-arm HOT 2
- plugin compile errorerror: 'mambo_context' {aka 'struct <anonymous>'} has no member named 'read_address' HOT 3
- cannot stop main thread when running on android HOT 9
- vcvtp instruction not handled HOT 1
- status flags currupted by inline hash lookup code HOT 4
- Is there any way to build Mambo as a Dynamic Linked Library?
- Continuous Integration (CI) HOT 1
- Unknown A64 instruction: 82 HOT 2
- Need help executing 32bit arm binaries on aarch64 HOT 3
- Unknown A64 instruction
- Segmentation fault when main thread finishes before its children
- ISPASS 2023 - MAMBO for RISC-V HOT 2
- Simple multithreaded program hangs on RISC-V HOT 3
- MAMBO fails to build on Arch Linux HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mambo.