qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH for-3.1 0/4] slirp: fix coverity issues
@ 2018-11-06 15:13 Peter Maydell
  2018-11-06 15:13 ` [Qemu-devel] [PATCH for-3.1 1/4] slirp: Don't pass possibly -1 fd to send() Peter Maydell
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Peter Maydell @ 2018-11-06 15:13 UTC (permalink / raw)
  To: qemu-devel; +Cc: patches, Samuel Thibault, Jan Kiszka

There are three outstanding Coverity issues for the slirp code.
This patchset fixes them:
 * easiest first, we explicitly check for so->s == -1 in slirp_send()
   to avoid possibly passing -1 to the send() function.
   In an ideal world we could assert() it wasn't -1, but the
   slirp code is too complicated to be sure...
 * we render a bug in an error-handling codepath moot by
   switching socreate() to use g_new() rather than malloc(),
   which means it can no longer fail and we can delete all the
   error-handling code
 * last and most complicated, we fix a lack of error handling
   and possible deadlock in fork_exec() by moving the child
   socket creation and connect to before fork(), where we can
   handle the errors appropriately

Tested with an aarch64 Linux guest which I got to do various
networky things including an 'apt-get update' and downloading
some packages. Also tested the '-net user,smb=/some/dir' which
is the most common use of the fork_exec() codepath.

I've taken the usual approach of "fix up the indentation
only locally so as to placate checkpatch" with this patchset.
Happy to adjust if you have some other preference.
(I'm veering towards the opinion that at some point we should
just say "globally reindent slirp/, because the piecemeal
approach hasn't in practice resulted in a very good outcome";
but that's up to you.)

Peter Maydell (4):
  slirp: Don't pass possibly -1 fd to send()
  slirp: Use g_new() to allocate sockets in socreate()
  slirp: Remove code that handles socreate() failure
  slirp: fork_exec(): create and connect child socket before fork()

 slirp/ip_icmp.c   |  2 +-
 slirp/misc.c      | 55 +++++++++++++++++++++++++++++------------------
 slirp/slirp.c     | 14 +++++++++---
 slirp/socket.c    | 17 ++++++---------
 slirp/tcp_input.c |  7 +++---
 slirp/tcp_subr.c  |  7 +-----
 slirp/udp.c       |  6 ------
 slirp/udp6.c      |  3 ---
 8 files changed, 56 insertions(+), 55 deletions(-)

-- 
2.19.1

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

end of thread, other threads:[~2018-11-06 23:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-06 15:13 [Qemu-devel] [PATCH for-3.1 0/4] slirp: fix coverity issues Peter Maydell
2018-11-06 15:13 ` [Qemu-devel] [PATCH for-3.1 1/4] slirp: Don't pass possibly -1 fd to send() Peter Maydell
2018-11-06 23:05   ` Samuel Thibault
2018-11-06 15:13 ` [Qemu-devel] [PATCH for-3.1 2/4] slirp: Use g_new() to allocate sockets in socreate() Peter Maydell
2018-11-06 23:07   ` Samuel Thibault
2018-11-06 15:13 ` [Qemu-devel] [PATCH for-3.1 3/4] slirp: Remove code that handles socreate() failure Peter Maydell
2018-11-06 23:08   ` Samuel Thibault
2018-11-06 15:13 ` [Qemu-devel] [PATCH for-3.1 4/4] slirp: fork_exec(): create and connect child socket before fork() Peter Maydell
2018-11-06 23:11   ` Samuel Thibault

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