From owner-p4-projects@FreeBSD.ORG Thu Sep 7 13:28:39 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id AE48D16A4EB; Thu, 7 Sep 2006 13:28:39 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7109B16A4E5 for ; Thu, 7 Sep 2006 13:28:39 +0000 (UTC) (envelope-from millert@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id E389A43D58 for ; Thu, 7 Sep 2006 13:28:11 +0000 (GMT) (envelope-from millert@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k87DS38M010885 for ; Thu, 7 Sep 2006 13:28:03 GMT (envelope-from millert@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k87DS3aK010882 for perforce@freebsd.org; Thu, 7 Sep 2006 13:28:03 GMT (envelope-from millert@freebsd.org) Date: Thu, 7 Sep 2006 13:28:03 GMT Message-Id: <200609071328.k87DS3aK010882@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to millert@freebsd.org using -f From: Todd Miller To: Perforce Change Reviews Cc: Subject: PERFORCE change 105780 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Sep 2006 13:28:39 -0000 http://perforce.freebsd.org/chv.cgi?CH=105780 Change 105780 by millert@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