Date: Thu, 17 May 2012 20:46:54 GMT From: Devin Teske <dteske@FreeBSD.org> To: freebsd-gnats-submit@FreeBSD.org Subject: kern/168077: [kernel] [PATCH] SMBFS option causes panic-on-boot with VIMAGE enabled Message-ID: <201205172046.q4HKksdg055980@red.freebsd.org> Resent-Message-ID: <201205172050.q4HKo2Dt055444@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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 <net/if.h> #include <net/route.h> +#include <net/vnet.h> #include <netinet/in.h> #include <netinet/tcp.h> @@ -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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205172046.q4HKksdg055980>