Date: Thu, 23 Feb 2006 19:03:53 GMT From: Todd Miller <millert@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 92280 for review Message-ID: <200602231903.k1NJ3rU0014290@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=92280 Change 92280 by millert@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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200602231903.k1NJ3rU0014290>