From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: Eduardo Habkost <ehabkost@redhat.com>,
Wenchao Wang <wenchao.wang@intel.com>,
"open list:X86 HAXM CPUs" <haxm-team@intel.com>,
Colin Xu <colin.xu@intel.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Richard Henderson <rth@twiddle.net>
Subject: [PULL 2/5] hax: Fix setting of FD_CLOEXEC
Date: Mon, 13 Jul 2020 09:21:03 -0500 [thread overview]
Message-ID: <20200713142106.261809-3-eblake@redhat.com> (raw)
In-Reply-To: <20200713142106.261809-1-eblake@redhat.com>
Blindly setting FD_CLOEXEC without a read-modify-write will
inadvertently clear any other intentionally-set bits, such as a
proposed new bit for designating a fd that must behave in 32-bit mode.
Use our wrapper function instead of an incorrect hand-rolled version.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20200420175309.75894-2-eblake@redhat.com>
Reviewed-by: Colin Xu <colin.xu@intel.com>
---
target/i386/hax-posix.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/target/i386/hax-posix.c b/target/i386/hax-posix.c
index 3bad89f13337..5f9d1b803dec 100644
--- a/target/i386/hax-posix.c
+++ b/target/i386/hax-posix.c
@@ -23,7 +23,7 @@ hax_fd hax_mod_open(void)
fprintf(stderr, "Failed to open the hax module\n");
}
- fcntl(fd, F_SETFD, FD_CLOEXEC);
+ qemu_set_cloexec(fd);
return fd;
}
@@ -147,7 +147,7 @@ hax_fd hax_host_open_vm(struct hax_state *hax, int vm_id)
fd = open(vm_name, O_RDWR);
g_free(vm_name);
- fcntl(fd, F_SETFD, FD_CLOEXEC);
+ qemu_set_cloexec(fd);
return fd;
}
@@ -200,7 +200,7 @@ hax_fd hax_host_open_vcpu(int vmid, int vcpuid)
if (fd < 0) {
fprintf(stderr, "Failed to open the vcpu devfs\n");
}
- fcntl(fd, F_SETFD, FD_CLOEXEC);
+ qemu_set_cloexec(fd);
return fd;
}
--
2.27.0
next prev parent reply other threads:[~2020-07-13 14:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-13 14:21 [PULL 0/5] NBD patches for 2020-07-13 Eric Blake
2020-07-13 14:21 ` [PULL 1/5] nbd: Avoid off-by-one in long export name truncation Eric Blake
2020-07-13 14:21 ` Eric Blake [this message]
2020-07-13 14:21 ` [PULL 3/5] iotests: QemuIoInteractive: use qemu_io_args_no_fmt Eric Blake
2020-07-13 14:21 ` [PULL 4/5] iotests.py: QemuIoInteractive: print output on failure Eric Blake
2020-07-13 14:21 ` [PULL 5/5] iotests.py: filter_testfiles(): filter SOCK_DIR too Eric Blake
2020-07-14 13:38 ` [PULL 0/5] NBD patches for 2020-07-13 Peter Maydell
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=20200713142106.261809-3-eblake@redhat.com \
--to=eblake@redhat.com \
--cc=colin.xu@intel.com \
--cc=ehabkost@redhat.com \
--cc=haxm-team@intel.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=wenchao.wang@intel.com \
/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).