qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Giuseppe Musacchio <thatlemon@gmail.com>
To: qemu-devel@nongnu.org
Cc: Riku Voipio <riku.voipio@iki.fi>, Laurent Vivier <laurent@vivier.eu>
Subject: [Qemu-devel] [PATCH] Avoid crash in epoll_ctl with EPOLL_CTL_DEL
Date: Thu, 30 May 2019 17:25:45 +0200	[thread overview]
Message-ID: <9028dc83-82a2-fc51-b559-0020b2c0a892@gmail.com> (raw)

The `event` parameter is ignored by the kernel if `op` is EPOLL_CTL_DEL,
do the same and avoid returning EFAULT if garbage is passed instead of a
valid pointer.

Signed-off-by: Giuseppe Musacchio <thatlemon@gmail.com>
---
  linux-user/syscall.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 5e29e675e9..32d463d58d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -11329,7 +11329,7 @@ static abi_long do_syscall1(void *cpu_env, int 
num, abi_long arg1,
      {
          struct epoll_event ep;
          struct epoll_event *epp = 0;
-        if (arg4) {
+        if (arg2 != EPOLL_CTL_DEL && arg4) {
              struct target_epoll_event *target_ep;
              if (!lock_user_struct(VERIFY_READ, target_ep, arg4, 1)) {
                  return -TARGET_EFAULT;
-- 
2.20.1



             reply	other threads:[~2019-05-30 15:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-30 15:25 Giuseppe Musacchio [this message]
2019-05-30 16:00 ` [Qemu-devel] [PATCH] Avoid crash in epoll_ctl with EPOLL_CTL_DEL Laurent Vivier
2019-05-30 16:12   ` Laurent Vivier
2019-05-30 19:48     ` Giuseppe Musacchio

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=9028dc83-82a2-fc51-b559-0020b2c0a892@gmail.com \
    --to=thatlemon@gmail.com \
    --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).