When running qemu-riscv64 on a riscv64 host executing a ET_EXEC riscv64
binary it cannot allocate memory for the stack:

$ qemu-riscv64 -d page ./hello.riscv64
host mmap_min_addr=0x10000
Locating guest address space @ 0x3ee000
page layout changed following mmap
start            end              size             prot
0000000000010000-0000000000013000 0000000000003000 ---
page layout changed following mmap
start            end              size             prot
0000000000010000-0000000000011000 0000000000001000 r-x
0000000000011000-0000000000013000 0000000000002000 ---
page layout changed following mmap
start            end              size             prot
0000000000010000-0000000000011000 0000000000001000 r-x
0000000000011000-0000000000013000 0000000000002000 rw-
mmap stack: Cannot allocate memory

The issue is that guest_base is non-zero, which turns the target_mmap
call with zero base in setup_arg_pages into a host mmap call with
non-zero base.  On other hosts like x86_64 or aarch64, guest_base
remains zero and the issue does not occur.

-- 
Andreas Schwab, SUSE Labs, sch...@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

Reply via email to