Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Zero out 'tv', to prevent uninitialized bytes in it...



details:   https://anonhg.NetBSD.org/src/rev/71740ddde4a6
branches:  trunk
changeset: 745054:71740ddde4a6
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Feb 22 08:39:33 2020 +0000

description:
Zero out 'tv', to prevent uninitialized bytes in its padding from leaking
to userland. Found by kMSan.

Reported-by: syzbot+8134380511a82c8f5fd7%syzkaller.appspotmail.com@localhost

diffstat:

 sys/kern/uipc_socket.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (26 lines):

diff -r f7268ac9e5c5 -r 71740ddde4a6 sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c    Sat Feb 22 08:22:09 2020 +0000
+++ b/sys/kern/uipc_socket.c    Sat Feb 22 08:39:33 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_socket.c,v 1.287 2020/02/21 00:26:22 joerg Exp $  */
+/*     $NetBSD: uipc_socket.c,v 1.288 2020/02/22 08:39:33 maxv Exp $   */
 
 /*
  * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.287 2020/02/21 00:26:22 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.288 2020/02/22 08:39:33 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1992,6 +1992,7 @@
                optval = (opt == SO_SNDTIMEO ?
                     so->so_snd.sb_timeo : so->so_rcv.sb_timeo);
 
+               memset(&tv, 0, sizeof(tv));
                tv.tv_sec = optval / hz;
                tv.tv_usec = (optval % hz) * tick;
 



Home | Main Index | Thread Index | Old Index