From owner-freebsd-current@freebsd.org Sun Aug 9 10:28:29 2015 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 264CF998884 for ; Sun, 9 Aug 2015 10:28:29 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E0359BB9; Sun, 9 Aug 2015 10:28:28 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from [IPv6:2a02:1811:2419:4e02:1c3c:f5bd:4afd:39bf] (unknown [IPv6:2a02:1811:2419:4e02:1c3c:f5bd:4afd:39bf]) by venus.codepro.be (Postfix) with ESMTPSA id 6A5C18D1F; Sun, 9 Aug 2015 12:28:24 +0200 (CEST) From: Kristof Provost Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Mailer: Apple Mail (2.3075) Subject: sysctl -a panic on VIMAGE kernels Date: Sun, 9 Aug 2015 12:28:22 +0200 Message-Id: Cc: Gleb Smirnoff To: freebsd-current@freebsd.org Mime-Version: 1.0 (Mac OS X Mail 9.0 \(3075\)) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Aug 2015 10:28:29 -0000 Hi, I=E2=80=99ve run into a reproducible panic on a VIMAGE kernel with = =E2=80=98sysctl -a=E2=80=99. Relevant backtrace bits: #8 0xffffffff80e7dd28 in trap (frame=3D0xfffffe01f16b26a0) at /usr/src/sys/amd64/amd64/trap.c:426 #9 0xffffffff80e5e6a2 in calltrap () at /usr/src/sys/amd64/amd64/exception.S:235 #10 0xffffffff80cea67d in uma_zone_get_cur (zone=3D0x0) at /usr/src/sys/vm/uma_core.c:3006 #11 0xffffffff80cec029 in sysctl_handle_uma_zone_cur ( oidp=3D0xffffffff818a7c90, arg1=3D0xfffffe00010c0438, arg2=3D0, req=3D0xfffffe01f16b2868) at /usr/src/sys/vm/uma_core.c:3580 #12 0xffffffff80a28614 in sysctl_root_handler_locked = (oid=3D0xffffffff818a7c90, arg1=3D0xfffffe00010c0438, arg2=3D0, req=3D0xfffffe01f16b2868) at /usr/src/sys/kern/kern_sysctl.c:183 #13 0xffffffff80a27d70 in sysctl_root (arg1=3D, arg2=3D) at = /usr/src/sys/kern/kern_sysctl.c:1694 #14 0xffffffff80a28372 in userland_sysctl (td=3D0x0, = name=3D0xfffffe01f16b2930, namelen=3D, old=3D, oldlenp=3D, inkernel=3D, new=3D, newlen=3D, retval=3D, flags=3D0) at /usr/src/sys/kern/kern_sysctl.c:1798 #15 0xffffffff80a28144 in sys___sysctl (td=3D0xfffff8000b1e49a0, uap=3D0xfffffe01f16b2a40) at /usr/src/sys/kern/kern_sysctl.c:1724 In essence, what happens is that we end up in = sysctl_handle_uma_zone_cur() and arg1 is a pointer to NULL,=20 so we call uma_zone_get_cur(zone); with zone =3D=3D NULL. There=E2=80=99s been a bit of churn around tcp_reass_zone, and I think = the latest version is wrong. It marks the sysctl as CTLFLAG_VNET, but the exposed variable is not = VNET_DEFINE(). The following fixes it for me: diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c index 77d8940..3913ef3 100644 --- a/sys/netinet/tcp_reass.c +++ b/sys/netinet/tcp_reass.c @@ -84,7 +84,7 @@ SYSCTL_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, = CTLFLAG_RDTUN, "Global maximum number of TCP Segments in Reassembly Queue"); static uma_zone_t tcp_reass_zone; -SYSCTL_UMA_CUR(_net_inet_tcp_reass, OID_AUTO, cursegments, = CTLFLAG_VNET, +SYSCTL_UMA_CUR(_net_inet_tcp_reass, OID_AUTO, cursegments, 0, &tcp_reass_zone, "Global number of TCP Segments currently in Reassembly Queue=E2=80=9D= ); Regards, Kristof=