qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, laurent@vivier.eu, evgreen@chromium.org
Subject: [Qemu-devel] [PATCH 5/6] linux-user: Check is_hostfd in mmap syscalls
Date: Thu, 31 May 2018 15:49:10 -0700	[thread overview]
Message-ID: <20180531224911.23725-6-richard.henderson@linaro.org> (raw)
In-Reply-To: <20180531224911.23725-1-richard.henderson@linaro.org>

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 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

  parent reply	other threads:[~2018-05-31 22:49 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-31 22:49 [Qemu-devel] [PATCH v5 0/6] linux-user: Reorg interp_prefix handling Richard Henderson
2018-05-31 22:49 ` [Qemu-devel] [PATCH 1/6] gdbstub: Return the fd from gdbserver_start Richard Henderson
2018-05-31 23:15   ` Philippe Mathieu-Daudé
2018-06-01  0:16     ` Richard Henderson
2018-06-01 12:42       ` Philippe Mathieu-Daudé
2018-06-01  8:59   ` Peter Maydell
2018-06-01 16:42     ` Richard Henderson
2018-06-01 20:00   ` Laurent Vivier
2018-05-31 22:49 ` [Qemu-devel] [PATCH 2/6] linux-user: Add host_fds and manipulators Richard Henderson
2018-06-01 20:05   ` Laurent Vivier
2018-05-31 22:49 ` [Qemu-devel] [PATCH 3/6] linux-user: Check is_hostfd in do_syscall Richard Henderson
2018-06-01 20:52   ` Laurent Vivier
2018-05-31 22:49 ` [Qemu-devel] [PATCH 4/6] linux-user: Check contains_hostfd in select syscalls Richard Henderson
2018-06-01 20:54   ` Laurent Vivier
2018-05-31 22:49 ` Richard Henderson [this message]
2018-06-01 20:57   ` [Qemu-devel] [PATCH 5/6] linux-user: Check is_hostfd in mmap syscalls Laurent Vivier
2018-05-31 22:49 ` [Qemu-devel] [PATCH 6/6] linux-user: Use *at functions to implement interp_prefix Richard Henderson
2018-06-04  1:04   ` Laurent Vivier
2018-06-05  5:27     ` Richard Henderson
2018-06-05  6:33       ` Laurent Vivier
2018-06-05 14:18         ` Richard Henderson
2018-06-05 14:27           ` Laurent Vivier
2018-06-05 10:52       ` Peter Maydell
2018-06-05 12:05         ` Laurent Vivier
2018-06-05 12:14           ` Peter Maydell
2018-06-05 12:23             ` Laurent Vivier
2018-06-05 12:27               ` Daniel P. Berrangé
2018-06-05 12:33               ` Peter Maydell
2018-06-05 12:37                 ` Laurent Vivier
2018-06-05 13:45         ` Richard Henderson
2018-06-05 14:14           ` Peter Maydell
2018-06-07  8:01       ` Laurent Vivier
2018-06-07 16:43         ` Richard Henderson
2018-06-15 22:51           ` Evan Green
2018-05-31 23:01 ` [Qemu-devel] [PATCH v5 0/6] linux-user: Reorg interp_prefix handling no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180531224911.23725-6-richard.henderson@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=evgreen@chromium.org \
    --cc=laurent@vivier.eu \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).