qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] fix fcntl(F_SETFD) usage
@ 2020-04-20 17:53 Eric Blake
  2020-04-20 17:53 ` [PATCH 1/2] hax: Fix setting of FD_CLOEXEC Eric Blake
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Eric Blake @ 2020-04-20 17:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, peter.maydell

As recently pointed out:
https://lists.gnu.org/archive/html/qemu-devel/2020-04/msg03133.html
code that blindly calls fcntl(fd, F_SETFD, 1) rather than performing a
read-modify-write when it intends to add FD_CLOEXEC is broken, in that
it can inadvertently clear other bits.

Thankfully, the culprits fixed in this series are unlikely to be
clearing either FD_CLOFORK (if Linux ever follows Solaris' lead in
adding that), or the new FD_32BIT_MODE being proposed (as the fds in
question are unlikely to have that set) - but it is still better to
write proper code than to set up a bad example prone to copy-and-paste
propagation.  And as these usages are not new to 5.0, I don't see any
reason against waiting until 5.1 to apply them.

Eric Blake (2):
  hax: Fix setting of FD_CLOEXEC
  tools: Fix use of fcntl(F_SETFD) during socket activation

 target/i386/hax-posix.c | 6 +++---
 util/systemd.c          | 4 +++-
 2 files changed, 6 insertions(+), 4 deletions(-)

-- 
2.26.1



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-06-02 17:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-20 17:53 [PATCH 0/2] fix fcntl(F_SETFD) usage Eric Blake
2020-04-20 17:53 ` [PATCH 1/2] hax: Fix setting of FD_CLOEXEC Eric Blake
2020-04-20 22:07   ` Eduardo Habkost
2020-06-02 17:47     ` Eric Blake
2020-04-21  1:22   ` Colin Xu
2020-04-20 17:53 ` [PATCH 2/2] tools: Fix use of fcntl(F_SETFD) during socket activation Eric Blake
2020-04-21 21:46   ` Eric Blake
2020-04-20 19:10 ` [PATCH 0/2] fix fcntl(F_SETFD) usage Peter Maydell

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).