PERFORCE change 105780 for review
Todd Miller
millert at FreeBSD.org
Thu Sep 7 13:50:03 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=105780
Change 105780 by millert at millert_g5tower on 2006/09/07 13:27:32
For labelh_modify(), if we need to allocate a new label
handle, use a non-blocking allocator since it is not always
safe to sleep where labelh_modify() is called. As a result,
labelh_new() takes a "canblock" flag.
Affected files ...
.. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/ipc/ipc_labelh.c#7 edit
.. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/ipc/ipc_labelh.h#4 edit
.. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/kern/task.c#3 edit
Differences ...
==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/ipc/ipc_labelh.c#7 (text+ko) ====
@@ -111,12 +111,12 @@
* port or the ipc_label_t structure itself.
*/
ipc_labelh_t
-labelh_new(void)
+labelh_new(int canblock)
{
ipc_labelh_t lh;
- lh = (ipc_labelh_t)zalloc(ipc_labelh_zone);
- io_lock_init(lh);
+ lh = (ipc_labelh_t)zalloc_canblock(ipc_labelh_zone, canblock);
+ lh_lock_init(lh);
lh->lh_port = ipc_port_alloc_kernel();
lh->lh_type = LABELH_TYPE_KERN;
lh->lh_references = 1;
@@ -137,7 +137,7 @@
{
ipc_labelh_t lh;
- lh = labelh_new();
+ lh = labelh_new(0);
ip_lock(lh->lh_port);
mac_task_init_label(&lh->lh_label);
mac_task_copy_label(&old->lh_label, &lh->lh_label);
==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/ipc/ipc_labelh.h#4 (text+ko) ====
@@ -46,7 +46,7 @@
void labelh_destroy(ipc_port_t port);
ipc_labelh_t labelh_duplicate(ipc_labelh_t old);
ipc_labelh_t labelh_modify(ipc_labelh_t old);
-ipc_labelh_t labelh_new(void);
+ipc_labelh_t labelh_new(int canblock);
kern_return_t labelh_new_user(ipc_space_t, struct label *, mach_port_name_t *);
void labelh_release(ipc_labelh_t lh);
ipc_labelh_t labelh_reference(ipc_labelh_t lh);
==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/kern/task.c#3 (text+ko) ====
@@ -429,7 +429,7 @@
#ifdef MAC
/*mutex_init(&new_task->labellock, ETAP_NO_TRACE);*/
- new_task->label = labelh_new ();
+ new_task->label = labelh_new(1);
mac_task_init_label(&new_task->maclabel);
#endif
More information about the trustedbsd-cvs
mailing list