Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Jun 2013 18:11:21 +0000 (UTC)
From:      Lawrence Stewart <lstewart@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r251752 - head/sys/kern
Message-ID:  <201306141811.r5EIBLUh020522@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: lstewart
Date: Fri Jun 14 18:11:21 2013
New Revision: 251752
URL: http://svnweb.freebsd.org/changeset/base/251752

Log:
  Fix a major oversight in r251732 which causes non-VIMAGE kernels to trigger a
  KASSERT during TCP hhook registration at boot. Virtualised hook points only
  require extra housekeeping and sanity checking when "options VIMAGE" is present.
  
  Reported by:	bdrewery,jh,dhw
  Tested by:	dhw
  MFC after:	1 week
  X-MFC with:	251732

Modified:
  head/sys/kern/kern_hhook.c

Modified: head/sys/kern/kern_hhook.c
==============================================================================
--- head/sys/kern/kern_hhook.c	Fri Jun 14 17:00:58 2013	(r251751)
+++ head/sys/kern/kern_hhook.c	Fri Jun 14 18:11:21 2013	(r251752)
@@ -267,9 +267,11 @@ hhook_head_register(int32_t hhook_type, 
 	HHHLIST_LOCK();
 	if (flags & HHOOK_HEADISINVNET) {
 		tmphhh->hhh_flags |= HHH_ISINVNET;
+#ifdef VIMAGE
 		KASSERT(curvnet != NULL, ("curvnet is NULL"));
 		tmphhh->hhh_vid = (uintptr_t)curvnet;
 		LIST_INSERT_HEAD(&V_hhook_vhead_list, tmphhh, hhh_vnext);
+#endif
 	}
 	LIST_INSERT_HEAD(&hhook_head_list, tmphhh, hhh_next);
 	HHHLIST_UNLOCK();
@@ -285,8 +287,10 @@ hhook_head_destroy(struct hhook_head *hh
 	HHHLIST_LOCK_ASSERT();
 
 	LIST_REMOVE(hhh, hhh_next);
+#ifdef VIMAGE
 	if (hhook_head_is_virtualised(hhh) == HHOOK_HEADISINVNET)
 		LIST_REMOVE(hhh, hhh_vnext);
+#endif
 	HHH_WLOCK(hhh);
 	STAILQ_FOREACH_SAFE(tmp, &hhh->hhh_hooks, hhk_next, tmp2)
 		free(tmp, M_HHOOK);
@@ -347,12 +351,14 @@ hhook_head_get(int32_t hhook_type, int32
 	HHHLIST_LOCK();
 	LIST_FOREACH(hhh, &hhook_head_list, hhh_next) {
 		if (hhh->hhh_type == hhook_type && hhh->hhh_id == hhook_id) {
+#ifdef VIMAGE
 			if (hhook_head_is_virtualised(hhh) ==
 			    HHOOK_HEADISINVNET) {
 				KASSERT(curvnet != NULL, ("curvnet is NULL"));
 				if (hhh->hhh_vid != (uintptr_t)curvnet)
 					continue;
 			}
+#endif
 			refcount_acquire(&hhh->hhh_refcount);
 			break;
 		}



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