Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1627770
| From | David Miller <davem@davemloft.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] net/packet: initialize val in packet_getsockopt() |
| Date | 2017-04-20 22:00 +0200 |
| Message-ID | <tyqpb-4ED-1@gated-at.bofh.it> (permalink) |
| References | <txFqi-xI-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Alexander Potapenko <glider@google.com> Date: Tue, 18 Apr 2017 19:47:08 +0200 > In the case getsockopt() is called with PACKET_HDRLEN and zero length, > |val| remains uninitialized and the syscall may behave differently > depending on its value. This doesn't have security consequences (as the > uninit bytes aren't copied back), but it's still cleaner to initialize > |val|. > > This bug has been detected with KMSAN. > > Signed-off-by: Alexander Potapenko <glider@google.com> Copying into an 'int' only 1, 2, or 3 bytes is not going to work properly. Either enforce that it must be 4 bytes long, or handle the smaller sizes properly such that it will work regardless of endianness. Thanks.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] net/packet: initialize val in packet_getsockopt() Alexander Potapenko <glider@google.com> - 2017-04-18 19:50 +0200 Re: [PATCH] net/packet: initialize val in packet_getsockopt() David Miller <davem@davemloft.net> - 2017-04-20 22:00 +0200
csiph-web