From owner-p4-projects@FreeBSD.ORG Mon Dec 4 18:44:46 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 7BFFF16A574; Mon, 4 Dec 2006 18:44:43 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9670F16A574 for ; Mon, 4 Dec 2006 18:44:42 +0000 (UTC) (envelope-from millert@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.FreeBSD.org (Postfix) with ESMTP id A581643C9D for ; Mon, 4 Dec 2006 18:44:07 +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 kB4Iift5092420 for ; Mon, 4 Dec 2006 18:44:41 GMT (envelope-from millert@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id kB4Iif24092415 for perforce@freebsd.org; Mon, 4 Dec 2006 18:44:41 GMT (envelope-from millert@freebsd.org) Date: Mon, 4 Dec 2006 18:44:41 GMT Message-Id: <200612041844.kB4Iif24092415@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 111058 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: Mon, 04 Dec 2006 18:44:46 -0000 http://perforce.freebsd.org/chv.cgi?CH=111058 Change 111058 by millert@millert_g5tower on 2006/12/04 18:44:35 Use sebsd_log() instead of printf() so we don't block. Affected files ... .. //depot/projects/trustedbsd/sedarwin8/policies/sedarwin/sedarwin/sebsd.c#50 edit Differences ... ==== //depot/projects/trustedbsd/sedarwin8/policies/sedarwin/sedarwin/sebsd.c#50 (text+ko) ==== @@ -243,9 +243,8 @@ printf("sebsd: init\n"); sebsd_zone_init(); avc_init(); - if (security_init()) { + if (security_init()) panic("SEBSD: couldn't read policy file"); - } sebsd_mach_av_init(); } @@ -837,7 +836,7 @@ if (error) { if (error == ENOATTR || error == ENOTSUP || error == EPERM) goto dosclass; - printf("%s: ERROR %d returned by mac_vnop_getxattr()\n", + sebsd_log("%s: ERROR %d returned by mac_vnop_getxattr()", __func__, error); return (error); /* Fail closed */ } @@ -850,7 +849,7 @@ error = security_context_to_sid(context, context_len, &vsec->sid); if (error) - printf("%s: ERROR mapping context to sid: %.*s\n", + sebsd_log("%s: ERROR mapping context to sid: %.*s", __func__, context_len, context); dosclass: @@ -894,7 +893,7 @@ vsec->sclass = vnode_type_to_security_class(vp->v_type); if (sbsec == NULL) { if (vp->v_mount != NULL) - printf ("vnode_create: no mount label for mnt=%s\n", + sebsd_log("vnode_create: no mount label for mnt=%s", vp->v_mount->mnt_vfsstat.f_mntonname); } else vsec->sid = sbsec->sid; @@ -1080,9 +1079,7 @@ */ if (security_transition_sid(tsec->sid, msqsec->sid, SECCLASS_MSG, &msgsec->sid) < 0) { - printf("Warning: security_transition_sid failed on" - "sysvmsg_label_associate\n"); - printf("Assigning the requesting thread's sid to the msg\n"); + sebsd_log("%s: security_transition_sid failed, using task sid"); msgsec->sid = tsec->sid; } } @@ -1155,7 +1152,7 @@ /* TBD: debugging */ if (sebsd_verbose > 1) { - printf("%s(%s): rc=%d, sclass=%d, computedsid=%d, dirent=%d\n", + sebsd_log("%s(%s): rc=%d, sclass=%d, computedsid=%d, dirent=%d", __func__, path, rc, dirent->sclass, newsid, dirent->sid); } sebsd_free(path, M_SEBSD); @@ -1187,8 +1184,8 @@ /* TBD: debugging */ if (sebsd_verbose > 1) { - printf("%s(%s): mountpoint=devfs, rc=%d, sclass=%d, " - "computedsid=%d, dirent=%d\n", + sebsd_log("%s(%s): mountpoint=devfs, rc=%d, sclass=%d, " + "computedsid=%d, dirent=%d", __func__, path, rc, dirent->sclass, newsid, dirent->sid); } sebsd_free(path, M_SEBSD); @@ -1219,8 +1216,6 @@ task = SLOT(cred->cr_label); task->osid = task->sid = SECINITSID_KERNEL; - printf("%s: using SECINITSID_KERNEL = %d\n", __func__, - SECINITSID_KERNEL); } static void @@ -1244,11 +1239,11 @@ sbsec = SLOT(mntlabel); rc = security_fs_use(mp->mnt_vfsstat.f_fstypename, &behavior, &sbsec->sid); if (rc) { - printf("%s: security_fs_use(%s) returned %d\n", __func__, - mp->mnt_vfsstat.f_fstypename, rc); + sebsd_log("%s: security_fs_use(%s) returned %d", + __func__, mp->mnt_vfsstat.f_fstypename, rc); behavior = SECURITY_FS_USE_NONE; } else if (sebsd_verbose > 1) { - printf("%s: security_fs_use(%s) behavior %d, sid %d\n", + sebsd_log("%s: security_fs_use(%s) behavior %d, sid %d", __func__, mp->mnt_vfsstat.f_fstypename, behavior, sbsec->sid); } @@ -1299,8 +1294,8 @@ */ break; default: - printf("%s: security_fs_use(%s) returned unrecognized " - "behavior %d\n", __func__, mp->mnt_vfsstat.f_fstypename, + sebsd_log("%s: security_fs_use(%s) returned unrecognized " + "behavior %d", __func__, mp->mnt_vfsstat.f_fstypename, behavior); behavior = SECURITY_FS_USE_NONE; break; @@ -1941,16 +1936,6 @@ source = SLOT(newlabel); dest = SLOT(pipelabel); - /* XXXRW: Should be KASSERT's? */ - if (!source) { - printf("%s: source is NULL!\n", __func__); - return; - } - if (!dest) { - printf("%s: dest is NULL!\n", __func__); - return; - } - dest->sid = source->sid; } @@ -1971,16 +1956,6 @@ source = SLOT(label); dest = SLOT(vnodelabel); - /* XXXRW: Should be KASSERT's? */ - if (!source) { - printf("%s: source is NULL!\n", __func__); - return; - } - if (!dest) { - printf("%s: dest is NULL!\n", __func__); - return; - } - dest->sid = source->sid; } @@ -2100,7 +2075,7 @@ sbsec = SLOT(dvp->v_mount->mnt_mntlabel); #ifdef SEFOS_DEBUG if (sbsec == NULL) { - printf ("vnode_create: no mount label for mnt=%s\n", + sebsd_log("vnode_create: no mount label for mnt=%s", dvp->v_mount->mnt_vfsstat.f_mntonname); return (0); } @@ -2383,8 +2358,8 @@ ad.u.fs.vp = vp; if (old->sclass == 0) { - printf("%s: ERROR, sid=%d, sclass=0, v_type=%d\n", __func__, - old->sid, vp->v_type); + sebsd_log("%s: ERROR, sid=%d, sclass=0, v_type=%d", + __func__, old->sid, vp->v_type); return (0); /* TBD: debugging */ } rc = avc_has_perm(task->sid, old->sid, old->sclass, @@ -2438,8 +2413,8 @@ if (rc) return (rc); if (old_file->sclass == 0) { - printf("%s: ERROR, sid=%d, sclass=0, v_type=%d\n", __func__, - old_file->sid, vp->v_type); + sebsd_log("%s: ERROR, sid=%d, sclass=0, v_type=%d", + __func__, old_file->sid, vp->v_type); return (0); /* TBD: debugging */ } @@ -2497,7 +2472,7 @@ rc = avc_has_perm(task->sid, new_dir->sid, SECCLASS_DIR, av, &ad); if (rc == 0 && vp != NULL) { if (new_file->sclass == 0) { - printf("%s: ERROR, sid=%d, sclass=0, v_type=%d\n", + sebsd_log("%s: ERROR, sid=%d, sclass=0, v_type=%d", __func__, new_file->sid, vp->v_type); return (0); /* TBD: debugging */ }