qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: Laurent Vivier <laurent@vivier.eu>
Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	qemu-devel@nongnu.org, "Riku Voipio" <riku.voipio@iki.fi>,
	"Guido Günther" <agx@sigxcpu.org>
Subject: [Qemu-devel] [PATCH v4 01/12] linux-user/syscall: Verify recvfrom(addr) is user-writable
Date: Tue,  3 Jul 2018 12:33:35 -0300	[thread overview]
Message-ID: <20180703153346.9050-2-f4bug@amsat.org> (raw)
In-Reply-To: <20180703153346.9050-1-f4bug@amsat.org>

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-By: Guido Günther <agx@sigxcpu.org>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/syscall.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 2117fb13b4..ad40682cee 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -4154,6 +4154,11 @@ static abi_long do_recvfrom(int fd, abi_ulong msg, size_t len, int flags,
             ret = -TARGET_EINVAL;
             goto fail;
         }
+        if (!access_ok(VERIFY_WRITE, target_addr, addrlen)) {
+            ret = -TARGET_EFAULT;
+            goto fail;
+        }
+
         addr = alloca(addrlen);
         ret = get_errno(safe_recvfrom(fd, host_msg, len, flags,
                                       addr, &addrlen));
-- 
2.18.0

  reply	other threads:[~2018-07-03 15:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-03 15:33 [Qemu-devel] [PATCH v4 00/12] linux-user: strace improvements Philippe Mathieu-Daudé
2018-07-03 15:33 ` Philippe Mathieu-Daudé [this message]
2018-07-03 15:33 ` [Qemu-devel] [PATCH v4 02/12] linux-user/strace: Improve capget()/capset() output Philippe Mathieu-Daudé
2018-07-03 15:33 ` [Qemu-devel] [PATCH v4 05/12] linux-user/strace: Improve settimeofday() Philippe Mathieu-Daudé
2018-07-03 15:33 ` [Qemu-devel] [PATCH v4 06/12] linux-user/syscall: Introduce target_sockaddr_nl Philippe Mathieu-Daudé
2018-07-03 15:33 ` [Qemu-devel] [PATCH v4 08/12] linux-user/strace: Improve recvmsg() output Philippe Mathieu-Daudé
2018-07-03 15:33 ` [Qemu-devel] [PATCH v4 09/12] linux-user/strace: Add print_sockfd() Philippe Mathieu-Daudé
2018-07-03 15:33 ` [Qemu-devel] [PATCH v4 10/12] linux-user/strace: Let print_sockaddr() have a 'last' argument Philippe Mathieu-Daudé

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=20180703153346.9050-2-f4bug@amsat.org \
    --to=f4bug@amsat.org \
    --cc=agx@sigxcpu.org \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /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).