summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2023-03-06 20:38:30 -0800
committerRichard Henderson <richard.henderson@linaro.org>2023-03-28 15:23:10 -0700
commit2f7828b5729337c61e6c58466d0d78af079db42d (patch)
treefe0d521b02aa970920afc68883141de5ccb3bb00
parent1ff4a81bd3efb207992f1da267886fe0c4df764f (diff)
downloadfocaccia-qemu-2f7828b5729337c61e6c58466d0d78af079db42d.tar.gz
focaccia-qemu-2f7828b5729337c61e6c58466d0d78af079db42d.zip
linux-user: Diagnose misaligned -R size
We have been enforcing host page alignment for the non-R
fallback of MAX_RESERVED_VA, but failing to enforce for -R.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
-rw-r--r--linux-user/main.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/linux-user/main.c b/linux-user/main.c
index 4b18461969..39d9bd4d7a 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -793,6 +793,12 @@ int main(int argc, char **argv, char **envp)
      */
     max_reserved_va = MAX_RESERVED_VA(cpu);
     if (reserved_va != 0) {
+        if (reserved_va % qemu_host_page_size) {
+            char *s = size_to_str(qemu_host_page_size);
+            fprintf(stderr, "Reserved virtual address not aligned mod %s\n", s);
+            g_free(s);
+            exit(EXIT_FAILURE);
+        }
         if (max_reserved_va && reserved_va > max_reserved_va) {
             fprintf(stderr, "Reserved virtual address too big\n");
             exit(EXIT_FAILURE);