Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 May 2004 13:58:24 -0700 (PDT)
From:      Peter Wemm <peter@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 52947 for review
Message-ID:  <200405172058.i4HKwOR5066898@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=52947

Change 52947 by peter@peter_hammer on 2004/05/17 13:58:08

	Fix refcount "bug".  If you have two loaders in a kernel, one has
	a kobj class refcount for the "kernel", the other has 0 refs.
	When you load/unload on the "other" loader, the refcount goes
	0->1->0.  And then kobj helpfully frees the compiled method table.
	
	Cheat, and fight fire with fire.  Since we can't ever unload
	classes, add a manual refcount boost to prevent this happening.

Affected files ...

.. //depot/projects/hammer/sys/kern/kern_linker.c#14 edit

Differences ...

==== //depot/projects/hammer/sys/kern/kern_linker.c#14 (text+ko) ====

@@ -148,6 +148,7 @@
 	if (linker_no_more_classes == 1)
 		return (EPERM);
 	kobj_class_compile((kobj_class_t) lc);
+	((kobj_class_t)lc)->refs++;	/* prevent ops being freed */
 	TAILQ_INSERT_TAIL(&classes, lc, link);
 	return (0);
 }



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