[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 1/7] linux-user: limit check to HOST_LONG_BITS < TARGET_ABI_BITS
From: |
Thomas Huth |
Subject: |
[PULL 1/7] linux-user: limit check to HOST_LONG_BITS < TARGET_ABI_BITS |
Date: |
Thu, 28 May 2020 12:10:33 +0200 |
From: Alex Bennée <alex.bennee@linaro.org>
Newer clangs rightly spot that you can never exceed the full address
space of 64 bit hosts with:
linux-user/elfload.c:2076:41: error: result of comparison 'unsigned
long' > 18446744073709551615 is always false
[-Werror,-Wtautological-type-limit-compare]
4685 if ((guest_hiaddr - guest_base) > ~(uintptr_t)0) {
4686 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~
4687 1 error generated.
So lets limit the check to 32 bit hosts only.
Fixes: ee94743034bf
Reported-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Message-Id: <20200525131823.715-8-thuth@redhat.com>
[thuth: Use HOST_LONG_BITS < TARGET_ABI_BITS instead of HOST_LONG_BITS == 32]
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
linux-user/elfload.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 01a9323a63..ebc663ea0b 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -2073,12 +2073,14 @@ static void pgb_have_guest_base(const char *image_name,
abi_ulong guest_loaddr,
exit(EXIT_FAILURE);
}
} else {
+#if HOST_LONG_BITS < TARGET_ABI_BITS
if ((guest_hiaddr - guest_base) > ~(uintptr_t)0) {
error_report("%s: requires more virtual address space "
"than the host can provide (0x%" PRIx64 ")",
image_name, (uint64_t)guest_hiaddr - guest_base);
exit(EXIT_FAILURE);
}
+#endif
}
/*
--
2.18.1
- [PULL 0/7] Gitlab CI fixes and improvements, Thomas Huth, 2020/05/28
- [PULL 1/7] linux-user: limit check to HOST_LONG_BITS < TARGET_ABI_BITS,
Thomas Huth <=
- [PULL 2/7] MAINTAINERS: Add Philippe, Alex and Wainer to the Gitlab-CI section, Thomas Huth, 2020/05/28
- [PULL 3/7] gitlab-ci: Remove flex/bison packages, Thomas Huth, 2020/05/28
- [PULL 4/7] GitLab CI: avoid calling before_scripts on unintended jobs, Thomas Huth, 2020/05/28
- [PULL 5/7] gitlab-ci: Move edk2 and opensbi YAML files to .gitlab-ci.d folder, Thomas Huth, 2020/05/28
- [PULL 6/7] gitlab-ci: Do not use the standard container images from gitlab, Thomas Huth, 2020/05/28
- [PULL 7/7] gitlab-ci: Determine the number of jobs dynamically, Thomas Huth, 2020/05/28
- Re: [PULL 0/7] Gitlab CI fixes and improvements, Peter Maydell, 2020/05/28