From owner-p4-projects Wed Oct 23 8:13: 3 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 2770937B404; Wed, 23 Oct 2002 08:13:00 -0700 (PDT) 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 B680037B401 for ; Wed, 23 Oct 2002 08:12:59 -0700 (PDT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6CFE143E42 for ; Wed, 23 Oct 2002 08:12:59 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id g9NFCKmV006788 for ; Wed, 23 Oct 2002 08:12:20 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id g9NFCGol006785 for perforce@freebsd.org; Wed, 23 Oct 2002 08:12:16 -0700 (PDT) Date: Wed, 23 Oct 2002 08:12:16 -0700 (PDT) Message-Id: <200210231512.g9NFCGol006785@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson Subject: PERFORCE change 19964 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://perforce.freebsd.org/chv.cgi?CH=19964 Change 19964 by rwatson@rwatson_tislabs on 2002/10/23 08:11:26 Teach mac_biba about sysctl: permit sysctl reads by any subject, but permit sysctl writes only if the subject meets our definition of Biba privileged (single==equal, either end of range==equal, range==low-high). This permits information flow via sysctl only for privileged subjects, and prohibits system reconfiguration by unprivileged subjects. Affected files ... .. //depot/projects/trustedbsd/mac/sys/security/mac_biba/mac_biba.c#151 edit Differences ... ==== //depot/projects/trustedbsd/mac/sys/security/mac_biba/mac_biba.c#151 (text+ko) ==== @@ -320,6 +320,14 @@ } static int +mac_biba_privileged(struct mac_biba *mac_biba) +{ + + /* Equate the notion of "equal" with privilege. */ + return (mac_biba_subject_equal_ok(mac_biba)); +} + +static int mac_biba_valid(struct mac_biba *mac_biba) { @@ -1807,6 +1815,30 @@ } static int +mac_biba_check_sysctl(struct ucred *cred, int *name, u_int namelen, + void *old, size_t *oldlenp, int inkernel, void *new, size_t newlen) +{ + struct mac_biba *subj; + + if (!mac_biba_enabled) + return (0); + + subj = SLOT(&cred->cr_label); + + /* + * Permit sysctl modification only if Biba-privileged; permit + * read by any process. + */ + if (new != NULL) { + if (!mac_biba_privileged(subj)) + return (EPERM); + } + + return (0); +} + + +static int mac_biba_check_vnode_chdir(struct ucred *cred, struct vnode *dvp, struct label *dlabel) { @@ -2606,6 +2638,8 @@ (macop_t)mac_biba_check_socket_relabel }, { MAC_CHECK_SOCKET_VISIBLE, (macop_t)mac_biba_check_socket_visible }, + { MAC_CHECK_SYSCTL, + (macop_t)mac_biba_check_sysctl }, { MAC_CHECK_VNODE_ACCESS, (macop_t)mac_biba_check_vnode_open }, { MAC_CHECK_VNODE_CHDIR, To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message