mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-21 00:53:27 -06:00
linux-user: Adjust task_unmapped_base for reserved_va
Ensure that the chosen values for mmap_next_start and task_unmapped_base are within the guest address space. Tested-by: Helge Deller <deller@gmx.de> Reviewed-by: Akihiko Odaki <akihiko.odaki@daynix.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
0450cf0897
commit
c8fb5cf97d
3 changed files with 64 additions and 16 deletions
|
@ -821,6 +821,34 @@ int main(int argc, char **argv, char **envp)
|
|||
reserved_va = max_reserved_va;
|
||||
}
|
||||
|
||||
/*
|
||||
* Temporarily disable
|
||||
* "comparison is always false due to limited range of data type"
|
||||
* due to comparison between (possible) uint64_t and uintptr_t.
|
||||
*/
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wtype-limits"
|
||||
|
||||
/*
|
||||
* Select an initial value for task_unmapped_base that is in range.
|
||||
*/
|
||||
if (reserved_va) {
|
||||
if (TASK_UNMAPPED_BASE < reserved_va) {
|
||||
task_unmapped_base = TASK_UNMAPPED_BASE;
|
||||
} else {
|
||||
/* The most common default formula is TASK_SIZE / 3. */
|
||||
task_unmapped_base = TARGET_PAGE_ALIGN(reserved_va / 3);
|
||||
}
|
||||
} else if (TASK_UNMAPPED_BASE < UINTPTR_MAX) {
|
||||
task_unmapped_base = TASK_UNMAPPED_BASE;
|
||||
} else {
|
||||
/* 32-bit host: pick something medium size. */
|
||||
task_unmapped_base = 0x10000000;
|
||||
}
|
||||
mmap_next_start = task_unmapped_base;
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
{
|
||||
Error *err = NULL;
|
||||
if (seed_optarg != NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue