PERFORCE change 52947 for review

Peter Wemm peter at FreeBSD.org
Mon May 17 13:58:26 PDT 2004


http://perforce.freebsd.org/chv.cgi?CH=52947

Change 52947 by peter at 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);
 }


More information about the p4-projects mailing list