All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@suse.de>
To: qemu-devel@nongnu.org
Subject: linux-user cannot allocate stack memory on riscv64 host due to non-zero guest_base
Date: Tue, 25 Jun 2024 13:37:19 +0200	[thread overview]
Message-ID: <mvm8qytp828.fsf@suse.de> (raw)

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, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


             reply	other threads:[~2024-06-25 11:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25 11:37 Andreas Schwab [this message]
2024-06-25 15:47 ` linux-user cannot allocate stack memory on riscv64 host due to non-zero guest_base Richard Henderson
2024-06-26  8:23   ` Andreas Schwab
2024-06-26 15:48     ` Richard Henderson
2024-06-26 15:54       ` Warner Losh
2024-06-27  7:54         ` Andreas Schwab
2024-06-27 14:14           ` Warner Losh
2024-06-27 14:26             ` Andreas Schwab
2024-06-27 14:55               ` Peter Maydell
2024-07-01 14:02                 ` Andreas Schwab
2024-07-01 16:05                   ` Richard Henderson
2024-07-02  8:09                     ` Andreas Schwab
2024-07-02 14:13                       ` Richard Henderson
2024-07-02 14:18                         ` Andreas Schwab
2024-07-02 14:18                       ` Richard Henderson
2024-07-02 14:39                         ` Andreas Schwab
2024-07-02 14:45                           ` Richard Henderson
2024-07-02 13:37                     ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mvm8qytp828.fsf@suse.de \
    --to=schwab@suse.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.