From owner-freebsd-bugs@FreeBSD.ORG Thu May 17 20:50:04 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A1351065816 for ; Thu, 17 May 2012 20:50:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id E7E868FC16 for ; Thu, 17 May 2012 20:50:02 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q4HKo2Z9055445 for ; Thu, 17 May 2012 20:50:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q4HKo2Dt055444; Thu, 17 May 2012 20:50:02 GMT (envelope-from gnats) Resent-Date: Thu, 17 May 2012 20:50:02 GMT Resent-Message-Id: <201205172050.q4HKo2Dt055444@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Devin Teske Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8BFDC1065686 for ; Thu, 17 May 2012 20:46:54 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 5DC618FC0C for ; Thu, 17 May 2012 20:46:54 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q4HKksrH055981 for ; Thu, 17 May 2012 20:46:54 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id q4HKksdg055980; Thu, 17 May 2012 20:46:54 GMT (envelope-from nobody) Message-Id: <201205172046.q4HKksdg055980@red.freebsd.org> Date: Thu, 17 May 2012 20:46:54 GMT From: Devin Teske To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/168077: [kernel] [PATCH] SMBFS option causes panic-on-boot with VIMAGE enabled X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 May 2012 20:50:04 -0000 >Number: 168077 >Category: kern >Synopsis: [kernel] [PATCH] SMBFS option causes panic-on-boot with VIMAGE enabled >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu May 17 20:50:02 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Devin Teske >Release: FreeBSD 8.3-RELEASE i386 >Organization: FIS Global, Inc. >Environment: FreeBSD push830.vicor.com 8.3-RELEASE FreeBSD 8.3-RELEASE #0: Mon Apr 9 21:47:23 UTC 2012 root@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386 >Description: Compiling a kernel with both the SMBFS and VIMAGE options enabled produces a kernel that panics immediately upon attempt to mount an SMB filesystem (using mount_smbfs(8)) -- regardless of whether the VIMAGE feature is used or not. >How-To-Repeat: Compile a custom kernel with both VIMAGE and SMBFS enabled. Boot said kernel. Attempt to use mount_smbfs(8) to mount an SMB share. Kernel Panic! >Fix: See attached patch. Patch attached with submission follows: --- sys/netsmb/smb_trantcp.c.orig 2010-06-13 19:09:06.000000000 -0700 +++ sys/netsmb/smb_trantcp.c 2011-12-05 17:16:50.000000000 -0800 @@ -52,6 +52,7 @@ #include #include +#include #include #include @@ -85,13 +86,17 @@ nb_setsockopt_int(struct socket *so, int level, int name, int val) { struct sockopt sopt; + int error; bzero(&sopt, sizeof(sopt)); sopt.sopt_level = level; sopt.sopt_name = name; sopt.sopt_val = &val; sopt.sopt_valsize = sizeof(val); - return sosetopt(so, &sopt); + CURVNET_SET(so->so_vnet); + error = sosetopt(so, &sopt); + CURVNET_RESTORE(); + return error; } static int @@ -292,8 +297,10 @@ auio.uio_offset = 0; auio.uio_resid = sizeof(len); auio.uio_td = td; + CURVNET_SET(so->so_vnet); error = soreceive(so, (struct sockaddr **)NULL, &auio, (struct mbuf **)NULL, (struct mbuf **)NULL, &flags); + CURVNET_RESTORE(); if (error) return error; if (auio.uio_resid > 0) { @@ -377,8 +384,10 @@ */ do { rcvflg = MSG_WAITALL; + CURVNET_SET(so->so_vnet); error = soreceive(so, (struct sockaddr **)NULL, &auio, &tm, (struct mbuf **)NULL, &rcvflg); + CURVNET_RESTORE(); } while (error == EWOULDBLOCK || error == EINTR || error == ERESTART); if (error) >Release-Note: >Audit-Trail: >Unformatted: