[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/6] linux-user: Check is_hostfd in mmap syscalls
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH 5/6] linux-user: Check is_hostfd in mmap syscalls |
Date: |
Thu, 31 May 2018 15:49:10 -0700 |
Signed-off-by: Richard Henderson <address@hidden>
---
linux-user/syscall.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index b98125829b..d7513d5dac 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -9605,11 +9605,17 @@ abi_long do_syscall(void *cpu_env, int num, abi_long
arg1,
v5 = tswapal(v[4]);
v6 = tswapal(v[5]);
unlock_user(v, arg1, 0);
+ if (is_hostfd(v5)) {
+ goto ebadf;
+ }
ret = get_errno(target_mmap(v1, v2, v3,
target_to_host_bitmask(v4,
mmap_flags_tbl),
v5, v6));
}
#else
+ if (is_hostfd(arg5)) {
+ goto ebadf;
+ }
ret = get_errno(target_mmap(arg1, arg2, arg3,
target_to_host_bitmask(arg4,
mmap_flags_tbl),
arg5,
@@ -9622,6 +9628,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
#ifndef MMAP_SHIFT
#define MMAP_SHIFT 12
#endif
+ if (is_hostfd(arg5)) {
+ goto ebadf;
+ }
ret = get_errno(target_mmap(arg1, arg2, arg3,
target_to_host_bitmask(arg4,
mmap_flags_tbl),
arg5,
--
2.17.0
- [Qemu-devel] [PATCH v5 0/6] linux-user: Reorg interp_prefix handling, Richard Henderson, 2018/05/31
- [Qemu-devel] [PATCH 1/6] gdbstub: Return the fd from gdbserver_start, Richard Henderson, 2018/05/31
- [Qemu-devel] [PATCH 2/6] linux-user: Add host_fds and manipulators, Richard Henderson, 2018/05/31
- [Qemu-devel] [PATCH 4/6] linux-user: Check contains_hostfd in select syscalls, Richard Henderson, 2018/05/31
- [Qemu-devel] [PATCH 5/6] linux-user: Check is_hostfd in mmap syscalls,
Richard Henderson <=
- [Qemu-devel] [PATCH 3/6] linux-user: Check is_hostfd in do_syscall, Richard Henderson, 2018/05/31
- [Qemu-devel] [PATCH 6/6] linux-user: Use *at functions to implement interp_prefix, Richard Henderson, 2018/05/31
- Re: [Qemu-devel] [PATCH v5 0/6] linux-user: Reorg interp_prefix handling, no-reply, 2018/05/31