Module Name:    src
Committed By:   martin
Date:           Fri Apr 19 09:12:58 UTC 2019

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

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

        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.13.6.2 -r1.13.6.3 src/sys/compat/common/uipc_syscalls_40.c
cvs rdiff -u -r1.138.6.3 -r1.138.6.4 \
    src/sys/compat/linux/common/linux_socket.c
cvs rdiff -u -r1.27.6.2 -r1.27.6.3 \
    src/sys/compat/linux32/common/linux32_socket.c
cvs rdiff -u -r1.394.2.15 -r1.394.2.16 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.13.6.2 src/sys/compat/common/uipc_syscalls_40.c:1.13.6.3
--- src/sys/compat/common/uipc_syscalls_40.c:1.13.6.2	Mon Dec  4 13:55:00 2017
+++ src/sys/compat/common/uipc_syscalls_40.c	Fri Apr 19 09:12:58 2019
@@ -1,9 +1,9 @@
-/*	$NetBSD: uipc_syscalls_40.c,v 1.13.6.2 2017/12/04 13:55:00 martin Exp $	*/
+/*	$NetBSD: uipc_syscalls_40.c,v 1.13.6.3 2019/04/19 09:12:58 martin Exp $	*/
 
 /* written by Pavel Cahyna, 2006. Public domain. */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.13.6.2 2017/12/04 13:55:00 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls_40.c,v 1.13.6.3 2019/04/19 09:12:58 martin Exp $");
 
 /*
  * System call interface to the socket abstraction.
@@ -42,6 +42,7 @@ compat_ifconf(u_long cmd, void *data)
 	int bound;
 	struct psref psref;
 
+	memset(&ifr, 0, sizeof(ifr));
 	if (docopy) {
 		space = ifc->ifc_len;
 		ifrp = ifc->ifc_req;

Index: src/sys/compat/linux/common/linux_socket.c
diff -u src/sys/compat/linux/common/linux_socket.c:1.138.6.3 src/sys/compat/linux/common/linux_socket.c:1.138.6.4
--- src/sys/compat/linux/common/linux_socket.c:1.138.6.3	Sat Dec  8 12:24:18 2018
+++ src/sys/compat/linux/common/linux_socket.c	Fri Apr 19 09:12:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_socket.c,v 1.138.6.3 2018/12/08 12:24:18 martin Exp $	*/
+/*	$NetBSD: linux_socket.c,v 1.138.6.4 2019/04/19 09:12:58 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.138.6.3 2018/12/08 12:24:18 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.138.6.4 2019/04/19 09:12:58 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -1152,6 +1152,7 @@ linux_getifconf(struct lwp *l, register_
 	if (error)
 		return error;
 
+	memset(&ifr, 0, sizeof(ifr));
 	docopy = ifc.ifc_req != NULL;
 	if (docopy) {
 		space = ifc.ifc_len;

Index: src/sys/compat/linux32/common/linux32_socket.c
diff -u src/sys/compat/linux32/common/linux32_socket.c:1.27.6.2 src/sys/compat/linux32/common/linux32_socket.c:1.27.6.3
--- src/sys/compat/linux32/common/linux32_socket.c:1.27.6.2	Sat May 12 10:29:08 2018
+++ src/sys/compat/linux32/common/linux32_socket.c	Fri Apr 19 09:12:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_socket.c,v 1.27.6.2 2018/05/12 10:29:08 martin Exp $ */
+/*	$NetBSD: linux32_socket.c,v 1.27.6.3 2019/04/19 09:12:58 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.27.6.2 2018/05/12 10:29:08 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_socket.c,v 1.27.6.3 2019/04/19 09:12:58 martin Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -431,6 +431,7 @@ linux32_getifconf(struct lwp *l, registe
 	if (error)
 		return error;
 
+	memset(&ifr, 0, sizeof(ifr));
 	docopy = NETBSD32PTR64(ifc.ifc_req) != NULL;
 	if (docopy) {
 		space = ifc.ifc_len;

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.394.2.15 src/sys/net/if.c:1.394.2.16
--- src/sys/net/if.c:1.394.2.15	Tue Nov  6 14:38:58 2018
+++ src/sys/net/if.c	Fri Apr 19 09:12:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.394.2.15 2018/11/06 14:38:58 martin Exp $	*/
+/*	$NetBSD: if.c,v 1.394.2.16 2019/04/19 09:12:58 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.394.2.15 2018/11/06 14:38:58 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.394.2.16 2019/04/19 09:12:58 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -3323,6 +3323,7 @@ ifconf(u_long cmd, void *data)
 	int bound;
 	struct psref psref;
 
+	memset(&ifr, 0, sizeof(ifr));
 	if (docopy) {
 		space = ifc->ifc_len;
 		ifrp = ifc->ifc_req;

Reply via email to