aboutsummaryrefslogtreecommitdiff
path: root/linux-user/syscall.c
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2019-05-19 13:19:52 -0700
committerLaurent Vivier <laurent@vivier.eu>2019-05-24 13:16:21 +0200
commit30ab9ef2967dde22193f609b6ec56101c156b061 (patch)
tree128863abc52b116065b5d5c162e0335592e60254 /linux-user/syscall.c
parentabcac736c1505254ec3f9587aff04fbe4705a55e (diff)
downloadqemu-30ab9ef2967dde22193f609b6ec56101c156b061.zip
qemu-30ab9ef2967dde22193f609b6ec56101c156b061.tar.gz
qemu-30ab9ef2967dde22193f609b6ec56101c156b061.tar.bz2
linux-user: Fix shmat emulation by honoring host SHMLBA
For those hosts with SHMLBA > getpagesize, we don't automatically select a guest address that is compatible with the host. We can achieve this by boosting the alignment of guest_base and by adding an extra alignment argument to mmap_find_vma. Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20190519201953.20161-13-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'linux-user/syscall.c')
-rw-r--r--linux-user/syscall.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index e5545cb..51cc049 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3912,7 +3912,8 @@ static inline abi_ulong do_shmat(CPUArchState *cpu_env,
else {
abi_ulong mmap_start;
- mmap_start = mmap_find_vma(0, shm_info.shm_segsz);
+ /* In order to use the host shmat, we need to honor host SHMLBA. */
+ mmap_start = mmap_find_vma(0, shm_info.shm_segsz, MAX(SHMLBA, shmlba));
if (mmap_start == -1) {
errno = ENOMEM;