Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Apr 2018 20:34:03 +0000 (UTC)
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r332230 - stable/11/sys/kern
Message-ID:  <201804072034.w37KY3Zn093649@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tuexen
Date: Sat Apr  7 20:34:03 2018
New Revision: 332230
URL: https://svnweb.freebsd.org/changeset/base/332230

Log:
  MFC r327844:
  
  Ensure that the vnet is set when calling pru_sockaddr() and
  pru_peeraddr().
  
  This is already true when called via kern_getsockname() and
  kern_getpeername(). This patch sets it also, when they arecalled
  via soo_fill_kinfo(). This is necessary, since the corresponding
  functions for SCTP require the vnet to be set. Without this,
  if a process having an wildcard bound SCTP socket is
  terminated and a core is written, the kernel panics.

Modified:
  stable/11/sys/kern/sys_socket.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/kern/sys_socket.c
==============================================================================
--- stable/11/sys/kern/sys_socket.c	Sat Apr  7 20:27:11 2018	(r332229)
+++ stable/11/sys/kern/sys_socket.c	Sat Apr  7 20:34:03 2018	(r332230)
@@ -346,6 +346,7 @@ soo_fill_kinfo(struct file *fp, struct kinfo_file *kif
 
 	kif->kf_type = KF_TYPE_SOCKET;
 	so = fp->f_data;
+	CURVNET_SET(so->so_vnet);
 	kif->kf_sock_domain = so->so_proto->pr_domain->dom_family;
 	kif->kf_sock_type = so->so_type;
 	kif->kf_sock_protocol = so->so_proto->pr_protocol;
@@ -387,6 +388,7 @@ soo_fill_kinfo(struct file *fp, struct kinfo_file *kif
 	}
 	strncpy(kif->kf_path, so->so_proto->pr_domain->dom_name,
 	    sizeof(kif->kf_path));
+	CURVNET_RESTORE();
 	return (0);	
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804072034.w37KY3Zn093649>