From owner-p4-projects@FreeBSD.ORG Tue Nov 14 18:54:25 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 AD2FF16A514; Tue, 14 Nov 2006 18:54:25 +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 8692016A500 for ; Tue, 14 Nov 2006 18:54:25 +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 BEC4643D45 for ; Tue, 14 Nov 2006 18:54:23 +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 kAEIsNjN013007 for ; Tue, 14 Nov 2006 18:54:23 GMT (envelope-from millert@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id kAEIsNCA013004 for perforce@freebsd.org; Tue, 14 Nov 2006 18:54:23 GMT (envelope-from millert@freebsd.org) Date: Tue, 14 Nov 2006 18:54:23 GMT Message-Id: <200611141854.kAEIsNCA013004@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 109963 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: Tue, 14 Nov 2006 18:54:25 -0000 http://perforce.freebsd.org/chv.cgi?CH=109963 Change 109963 by millert@millert_g5tower on 2006/11/14 18:53:27 Add mac_task_get_label() to return a label's task; you must already be holding a reference to the task for this to be safe. An alternate approach would be for mac_task_get_label() to take a reference to the label handle itself, but this would require the caller to drop the handle which is not possible due to struct task * being opaque. Affected files ... .. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/kern/task.c#7 edit .. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/security/mac_mach_internal.h#9 edit Differences ... ==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/osfmk/kern/task.c#7 (text+ko) ==== @@ -1760,4 +1760,10 @@ lh_check_unlock(oldlabel); tasklabel_unlock(task); } + +struct label * +mac_task_get_label(struct task *task) +{ + return (&task->maclabel); +} #endif ==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/security/mac_mach_internal.h#9 (text+ko) ==== @@ -46,6 +46,7 @@ void mac_task_label_associate_kernel(struct task *, struct label *, struct label *); void mac_task_label_modify( struct task *pt, void *arg, void (*f)(struct label *l, void *arg)); +struct label *mac_task_get_label(struct task *task); /* ports */ void mac_port_label_init(struct label *l);