From owner-p4-projects@FreeBSD.ORG Mon Jul 4 12:53:00 2005 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 8C27916A420; Mon, 4 Jul 2005 12:52:59 +0000 (GMT) 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 2FDE316A41C for ; Mon, 4 Jul 2005 12:52:59 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1645A43D45 for ; Mon, 4 Jul 2005 12:52:59 +0000 (GMT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j64CqwEp081706 for ; Mon, 4 Jul 2005 12:52:58 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j64CqwVV081703 for perforce@freebsd.org; Mon, 4 Jul 2005 12:52:58 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Mon, 4 Jul 2005 12:52:58 GMT Message-Id: <200507041252.j64CqwVV081703@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 To: Perforce Change Reviews Cc: Subject: PERFORCE change 79546 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 Jul 2005 12:53:00 -0000 http://perforce.freebsd.org/chv.cgi?CH=79546 Change 79546 by rwatson@rwatson_paprika on 2005/07/04 12:52:26 Authorize various new/old suser() checks relating to hardware configuration, such as uploading firmware, as CAP_SYS_RAWIO. Affected files ... .. //depot/projects/trustedbsd/sebsd/sys/dev/drm/drmP.h#10 edit .. //depot/projects/trustedbsd/sebsd/sys/dev/fdc/fdc.c#3 edit .. //depot/projects/trustedbsd/sebsd/sys/dev/ipw/if_ipw.c#2 edit .. //depot/projects/trustedbsd/sebsd/sys/dev/iwi/if_iwi.c#2 edit .. //depot/projects/trustedbsd/sebsd/sys/i386/i386/io.c#2 edit Differences ... ==== //depot/projects/trustedbsd/sebsd/sys/dev/drm/drmP.h#10 (text+ko) ==== @@ -223,7 +223,7 @@ int flags, DRM_STRUCTPROC *p, DRMFILE filp #define PAGE_ALIGN(addr) round_page(addr) -#define DRM_SUSER(p) suser(p) +#define DRM_SUSER(p) cap_check(p, CAP_SYS_RAWIO) #define DRM_AGP_FIND_DEVICE() agp_find_device() #define DRM_MTRR_WC MDF_WRITECOMBINE #define jiffies ticks ==== //depot/projects/trustedbsd/sebsd/sys/dev/fdc/fdc.c#3 (text+ko) ==== @@ -58,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -1473,7 +1474,7 @@ return (0); case FD_CLRERR: - if (suser(td) != 0) + if (cap_check(td, CAP_SYS_RAWIO) != 0) return (EPERM); fd->fdc->fdc_errs = 0; return (0); ==== //depot/projects/trustedbsd/sebsd/sys/dev/ipw/if_ipw.c#2 (text+ko) ==== @@ -1544,7 +1544,7 @@ case SIOCSLOADFW: /* only super-user can do that! */ - if ((error = suser(curthread)) != 0) + if ((error = cap_check(curthread, CAP_SYS_RAWIO)) != 0) break; ifr = (struct ifreq *)data; @@ -1553,7 +1553,7 @@ case SIOCSKILLFW: /* only super-user can do that! */ - if ((error = suser(curthread)) != 0) + if ((error = cap_check(curthread, CAP_SYS_RAWIO)) != 0) break; ifp->if_flags &= ~IFF_UP; ==== //depot/projects/trustedbsd/sebsd/sys/dev/iwi/if_iwi.c#2 (text+ko) ==== @@ -1550,7 +1550,7 @@ case SIOCSLOADFW: /* only super-user can do that! */ - if ((error = suser(curthread)) != 0) + if ((error = cap_check(curthread, CAP_SYS_RAWIO)) != 0) break; ifr = (struct ifreq *)data; @@ -1559,7 +1559,7 @@ case SIOCSKILLFW: /* only super-user can do that! */ - if ((error = suser(curthread)) != 0) + if ((error = cap_check(curthread, CAP_SYS_RAWIO)) != 0) break; ifp->if_flags &= ~IFF_UP; ==== //depot/projects/trustedbsd/sebsd/sys/i386/i386/io.c#2 (text+ko) ==== @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD: src/sys/i386/i386/io.c,v 1.1 2004/08/01 11:40:52 markm Exp $"); #include +#include #include #include #include @@ -54,7 +55,7 @@ { int error; - error = suser(td); + error = cap_check(td, CAP_SYS_RAWIO); if (error != 0) return (error); error = securelevel_gt(td->td_ucred, 0);