Module Name:    src
Committed By:   martin
Date:           Fri Apr 19 16:02:24 UTC 2019

Modified Files:
        src/sys/compat/common [netbsd-7-1]: uipc_syscalls_40.c
        src/sys/compat/linux/common [netbsd-7-1]: linux_socket.c
        src/sys/compat/linux32/common [netbsd-7-1]: linux32_socket.c
        src/sys/net [netbsd-7-1]: if.c

Log Message:
Pull up following revision(s) via patch (requested by christos in ticket #1689):

        sys/compat/linux/common/linux_socket.c: revision 1.145
        sys/net/if.c: revision 1.449
        sys/compat/linux32/common/linux32_socket.c: revision 1.30
        sys/compat/common/uipc_syscalls_40.c: revision 1.19

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks!

 -

Zero out the ifreq struct for SIOCGIFCONF to avoid up to 127 bytes of stack
disclosure. From Andy Nguyen, many thanks! This is the compat code part
pointed out by ozaki-r@


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.38.1 src/sys/compat/common/uipc_syscalls_40.c
cvs rdiff -u -r1.119.2.1 -r1.119.2.1.6.1 \
    src/sys/compat/linux/common/linux_socket.c
cvs rdiff -u -r1.18 -r1.18.8.1 src/sys/compat/linux32/common/linux32_socket.c
cvs rdiff -u -r1.290.2.1 -r1.290.2.1.6.1 src/sys/net/if.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/common/uipc_syscalls_40.c
diff -u src/sys/compat/common/uipc_syscalls_40.c:1.7 src/sys/compat/common/uipc_syscalls_40.c:1.7.38.1
--- src/sys/compat/common/uipc_syscalls_40.c:1.7	Wed Jan 19 10:21:16 2011
+++ src/sys/compat/common/uipc_syscalls_40.c	Fri Apr 19 16:02:24 2019
@@ -1,9 +1,9 @@
-/*	$NetBSD: uipc_syscalls_40.c,v 1.7 2011/01/19 10:21:16 tsutsui Exp $	*/
+/*	$NetBSD: uipc_syscalls_40.c,v 1.7.38.1 2019/04/19 16:02:24 martin Exp $	*/
 
 /* written by Pavel Cahyna, 2006. Public domain. */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.7 2011/01/19 10:21:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.7.38.1 2019/04/19 16:02:24 martin Exp $");
 
 /*
  * System call interface to the socket abstraction.
@@ -39,6 +39,7 @@ compat_ifconf(u_long cmd, void *data)
 	int space, error = 0;
 	const int sz = (int)sizeof(ifr);
 
+	memset(&ifr, 0, sizeof(ifr));
 	if ((ifrp = ifc->ifc_req) == NULL)
 		space = 0;
 	else

Index: src/sys/compat/linux/common/linux_socket.c
diff -u src/sys/compat/linux/common/linux_socket.c:1.119.2.1 src/sys/compat/linux/common/linux_socket.c:1.119.2.1.6.1
--- src/sys/compat/linux/common/linux_socket.c:1.119.2.1	Sat Jan 17 12:10:54 2015
+++ src/sys/compat/linux/common/linux_socket.c	Fri Apr 19 16:02:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_socket.c,v 1.119.2.1 2015/01/17 12:10:54 martin Exp $	*/
+/*	$NetBSD: linux_socket.c,v 1.119.2.1.6.1 2019/04/19 16:02:24 martin Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.119.2.1 2015/01/17 12:10:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.119.2.1.6.1 2019/04/19 16:02:24 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1124,6 +1124,7 @@ linux_getifconf(struct lwp *l, register_
 	if (error)
 		return error;
 
+	memset(&ifr, 0, sizeof(ifr));
 	ifrp = ifc.ifc_req;
 	if (ifrp == NULL)
 		space = 0;

Index: src/sys/compat/linux32/common/linux32_socket.c
diff -u src/sys/compat/linux32/common/linux32_socket.c:1.18 src/sys/compat/linux32/common/linux32_socket.c:1.18.8.1
--- src/sys/compat/linux32/common/linux32_socket.c:1.18	Sat May 17 21:26:20 2014
+++ src/sys/compat/linux32/common/linux32_socket.c	Fri Apr 19 16:02:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_socket.c,v 1.18 2014/05/17 21:26:20 rmind Exp $ */
+/*	$NetBSD: linux32_socket.c,v 1.18.8.1 2019/04/19 16:02:24 martin Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: linux32_socket.c,v 1.18 2014/05/17 21:26:20 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_socket.c,v 1.18.8.1 2019/04/19 16:02:24 martin Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -423,6 +423,7 @@ linux32_getifconf(struct lwp *l, registe
 	if (error)
 		return error;
 
+	memset(&ifr, 0, sizeof(ifr));
 	ifrp = NETBSD32PTR64(ifc.ifc_req);
 	if (ifrp == NULL)
 		space = 0;

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.290.2.1 src/sys/net/if.c:1.290.2.1.6.1
--- src/sys/net/if.c:1.290.2.1	Tue Nov 11 12:20:28 2014
+++ src/sys/net/if.c	Fri Apr 19 16:02:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.290.2.1 2014/11/11 12:20:28 martin Exp $	*/
+/*	$NetBSD: if.c,v 1.290.2.1.6.1 2019/04/19 16:02:24 martin Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.290.2.1 2014/11/11 12:20:28 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.290.2.1.6.1 2019/04/19 16:02:24 martin Exp $");
 
 #include "opt_inet.h"
 
@@ -2092,6 +2092,7 @@ ifconf(u_long cmd, void *data)
 	int space, error = 0;
 	const int sz = (int)sizeof(struct ifreq);
 
+	memset(&ifr, 0, sizeof(ifr));
 	if ((ifrp = ifc->ifc_req) == NULL)
 		space = 0;
 	else

Reply via email to