[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/9] linux-user: Diagnose incorrect -R size
From: |
Richard Henderson |
Subject: |
[PATCH 1/9] linux-user: Diagnose incorrect -R size |
Date: |
Sun, 5 Mar 2023 18:12:59 -0800 |
Zero is the value for 'off', and should not be used with -R.
We have been enforcing host page alignment for the non-R
fallback of MAX_RESERVED_VA, but failing to enforce for -R.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
linux-user/main.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/linux-user/main.c b/linux-user/main.c
index 4ff30ff980..f4dea25242 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -395,6 +395,16 @@ static void handle_arg_reserved_va(const char *arg)
fprintf(stderr, "Unrecognised -R size suffix '%s'\n", p);
exit(EXIT_FAILURE);
}
+ if (reserved_va == 0) {
+ fprintf(stderr, "Invalid -R size value 0\n");
+ exit(EXIT_FAILURE);
+ }
+ /* Must be aligned with the host page size as it is used with mmap. */
+ if (reserved_va & qemu_host_page_mask) {
+ fprintf(stderr, "Invalid -R size value %lu: must be aligned mod %lu\n",
+ reserved_va, qemu_host_page_size);
+ exit(EXIT_FAILURE);
+ }
}
static void handle_arg_singlestep(const char *arg)
--
2.34.1
- [PATCH 0/9] accel/tcg: Fix page_set_flags and related [#1528], Richard Henderson, 2023/03/05
- [PATCH 1/9] linux-user: Diagnose incorrect -R size,
Richard Henderson <=
- Re: [PATCH 1/9] linux-user: Diagnose incorrect -R size, Peter Maydell, 2023/03/06
- Re: [PATCH 1/9] linux-user: Diagnose incorrect -R size, Richard Henderson, 2023/03/06
- Re: [PATCH 1/9] linux-user: Diagnose incorrect -R size, Peter Maydell, 2023/03/07
- Re: [PATCH 1/9] linux-user: Diagnose incorrect -R size, Peter Maydell, 2023/03/07
- Re: [PATCH 1/9] linux-user: Diagnose incorrect -R size, Richard Henderson, 2023/03/17
- Re: [PATCH 1/9] linux-user: Diagnose incorrect -R size, Peter Maydell, 2023/03/17
- Re: [PATCH 1/9] linux-user: Diagnose incorrect -R size, Peter Maydell, 2023/03/17
[PATCH 2/9] linux-user: Rename max_reserved_va in main, Richard Henderson, 2023/03/05
[PATCH 5/9] accel/tcg: Pass last not end to page_reset_target_data, Richard Henderson, 2023/03/05