From owner-svn-src-all@FreeBSD.ORG Sun Aug 2 16:59:02 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C17D41065680; Sun, 2 Aug 2009 16:59:02 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AFAEF8FC0A; Sun, 2 Aug 2009 16:59:02 +0000 (UTC) (envelope-from julian@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n72Gx20P019862; Sun, 2 Aug 2009 16:59:02 GMT (envelope-from julian@svn.freebsd.org) Received: (from julian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n72Gx23r019861; Sun, 2 Aug 2009 16:59:02 GMT (envelope-from julian@svn.freebsd.org) Message-Id: <200908021659.n72Gx23r019861@svn.freebsd.org> From: Julian Elischer Date: Sun, 2 Aug 2009 16:59:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196038 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Aug 2009 16:59:03 -0000 Author: julian Date: Sun Aug 2 16:59:02 2009 New Revision: 196038 URL: http://svn.freebsd.org/changeset/base/196038 Log: Stop uuidgen(2) from crashing in vimage kerenels. make curvnet valid when needed. Reviewed by: bz@ Approved by: re (kib) Modified: head/sys/kern/kern_uuid.c Modified: head/sys/kern/kern_uuid.c ============================================================================== --- head/sys/kern/kern_uuid.c Sun Aug 2 14:28:40 2009 (r196037) +++ head/sys/kern/kern_uuid.c Sun Aug 2 16:59:02 2009 (r196038) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -93,6 +94,7 @@ uuid_node(uint16_t *node) struct sockaddr_dl *sdl; int i; + CURVNET_SET(TD_TO_VNET(curthread)); IFNET_RLOCK(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { /* Walk the address list */ @@ -105,6 +107,7 @@ uuid_node(uint16_t *node) bcopy(LLADDR(sdl), node, UUID_NODE_LEN); IF_ADDR_UNLOCK(ifp); IFNET_RUNLOCK(); + CURVNET_RESTORE(); return; } } @@ -115,6 +118,7 @@ uuid_node(uint16_t *node) for (i = 0; i < (UUID_NODE_LEN>>1); i++) node[i] = (uint16_t)arc4random(); *((uint8_t*)node) |= 0x01; + CURVNET_RESTORE(); } /*