All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-6.2 0/4] Zero sockaddr_in when initializing it
@ 2021-08-13 15:05 Peter Maydell
  2021-08-13 15:05 ` [PATCH for-6.2 1/4] net: Zero sockaddr_in in parse_host_port() Peter Maydell
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Peter Maydell @ 2021-08-13 15:05 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alex Bennée, Philippe Mathieu-Daudé,
	Jason Wang, Eric Blake, Corey Minyard

The POSIX spec for sockaddr_in says that implementations are allowed
to have implementation-dependent extensions controlled by extra
fields in the struct, and that the way to ensure these are not
accidentally activated is to zero out the whole data structure.
We have several places in our codebase where we don't zero-init
sockaddr_in structs and so (at least in theory) might run into this.
Coverity spotted the ones in the net code (CID 1005338); the
others in this series I found by looking at all uses of sockaddr_in.
(The gdbstub patch changes also a sockaddr_un use, for symmetry.)

Thanks to Eric for the analysis of what the spec says and why
Coverity is correct here.

thanks
-- PMM

Peter Maydell (4):
  net: Zero sockaddr_in in parse_host_port()
  gdbstub: Zero-initialize sockaddr structs
  tests/qtest/ipmi-bt-test: Zero-initialize sockaddr struct
  tests/tcg/multiarch/linux-test: Zero-initialize sockaddr structs

 gdbstub.c                        | 4 ++--
 net/net.c                        | 2 ++
 tests/qtest/ipmi-bt-test.c       | 2 +-
 tests/tcg/multiarch/linux-test.c | 4 ++--
 4 files changed, 7 insertions(+), 5 deletions(-)

-- 
2.20.1



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

end of thread, other threads:[~2021-08-26 14:39 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-13 15:05 [PATCH for-6.2 0/4] Zero sockaddr_in when initializing it Peter Maydell
2021-08-13 15:05 ` [PATCH for-6.2 1/4] net: Zero sockaddr_in in parse_host_port() Peter Maydell
2021-08-13 18:34   ` Eric Blake
2021-08-13 15:05 ` [PATCH for-6.2 2/4] gdbstub: Zero-initialize sockaddr structs Peter Maydell
2021-08-13 18:37   ` Eric Blake
2021-08-13 15:05 ` [PATCH for-6.2 3/4] tests/qtest/ipmi-bt-test: Zero-initialize sockaddr struct Peter Maydell
2021-08-13 18:38   ` Eric Blake
2021-08-14  6:41   ` Thomas Huth
2021-08-14 15:46   ` Corey Minyard
2021-08-13 15:05 ` [PATCH for-6.2 4/4] tests/tcg/multiarch/linux-test: Zero-initialize sockaddr structs Peter Maydell
2021-08-13 18:39   ` Eric Blake
2021-08-13 18:30 ` [PATCH for-6.2 0/4] Zero sockaddr_in when initializing it Eric Blake
2021-08-15 14:34   ` Philippe Mathieu-Daudé
2021-08-15 15:44     ` Peter Maydell
2021-08-15 16:13       ` Philippe Mathieu-Daudé
2021-08-26 14:34 ` Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.