PERFORCE change 92280 for review
Todd Miller
millert at FreeBSD.org
Thu Feb 23 11:03:56 PST 2006
http://perforce.freebsd.org/chv.cgi?CH=92280
Change 92280 by millert at millert_g4tower on 2006/02/23 19:02:58
Fix long-standing panic. io_free() calls mac_destroy_port_label()
on a potentially-uninitialized port label. To fix, be sure
to always intialized a port's label after its creation by
io_alloc(). The best place for this is right after the
ipc_port_t is bzero()d.
Affected files ...
.. //depot/projects/trustedbsd/sedarwin7/src/darwin/xnu/osfmk/ipc/ipc_object.c#8 edit
Differences ...
==== //depot/projects/trustedbsd/sedarwin7/src/darwin/xnu/osfmk/ipc/ipc_object.c#8 (text+ko) ====
@@ -336,6 +336,9 @@
ipc_port_t port = (ipc_port_t)object;
bzero((char *)port, sizeof(*port));
+#ifdef MAC
+ mac_init_port_label(&port->ip_label);
+#endif
} else if (otype == IOT_PORT_SET) {
ipc_pset_t pset = (ipc_pset_t)object;
@@ -404,6 +407,9 @@
ipc_port_t port = (ipc_port_t)object;
bzero((char *)port, sizeof(*port));
+#ifdef MAC
+ mac_init_port_label(&port->ip_label);
+#endif
} else if (otype == IOT_PORT_SET) {
ipc_pset_t pset = (ipc_pset_t)object;
@@ -999,7 +1005,8 @@
* User allocated label handles can never be modified.
*/
-struct label *io_getlabel (ipc_object_t objp)
+struct label *io_getlabel(
+ ipc_object_t objp)
{
ipc_port_t port = (ipc_port_t) objp;
@@ -1030,10 +1037,8 @@
#endif /* MACH_ASSERT */
#ifdef MAC
- /* XXX: This was never getting called before,
- and calling it now causes problems. */
-
- mac_destroy_port_label (&port->ip_label);
+ /* Port label should have been initialized after creation. */
+ mac_destroy_port_label(&port->ip_label);
#endif
}
zfree(ipc_object_zones[otype], (vm_offset_t) object);
More information about the trustedbsd-cvs
mailing list