[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 4/6] linux-user: Check contains_hostfd in select sys
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH 4/6] linux-user: Check contains_hostfd in select syscalls |
Date: |
Thu, 31 May 2018 15:49:09 -0700 |
Signed-off-by: Richard Henderson <address@hidden>
---
linux-user/syscall.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 5339f0bc1c..b98125829b 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -1506,6 +1506,11 @@ static abi_long do_select(int n,
if (ret) {
return ret;
}
+ if (contains_hostfd(&rfds) ||
+ contains_hostfd(&wfds) ||
+ contains_hostfd(&efds)) {
+ return -TARGET_EBADF;
+ }
if (target_tv_addr) {
if (copy_from_user_timeval(&tv, target_tv_addr))
@@ -9392,6 +9397,11 @@ abi_long do_syscall(void *cpu_env, int num, abi_long
arg1,
if (ret) {
goto fail;
}
+ if (contains_hostfd(&rfds) ||
+ contains_hostfd(&wfds) ||
+ contains_hostfd(&efds)) {
+ goto ebadf;
+ }
/*
* This takes a timespec, and not a timeval, so we cannot
--
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 <=
- [Qemu-devel] [PATCH 5/6] linux-user: Check is_hostfd in mmap syscalls, Richard Henderson, 2018/05/31
- [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