From owner-p4-projects@FreeBSD.ORG Thu Jan 24 13:34:36 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E689516A469; Thu, 24 Jan 2008 13:34:35 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9376916A421 for ; Thu, 24 Jan 2008 13:34:35 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 8565113C4D5 for ; Thu, 24 Jan 2008 13:34:35 +0000 (UTC) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m0ODYZfv056483 for ; Thu, 24 Jan 2008 13:34:35 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m0ODYZcG056480 for perforce@freebsd.org; Thu, 24 Jan 2008 13:34:35 GMT (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Thu, 24 Jan 2008 13:34:35 GMT Message-Id: <200801241334.m0ODYZcG056480@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 134007 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, 24 Jan 2008 13:34:36 -0000 http://perforce.freebsd.org/chv.cgi?CH=134007 Change 134007 by rwatson@rwatson_freebsd_capabilities on 2008/01/24 13:34:21 Add ENOTCAPABLE and return this instead of EACCES when a capability rights check fails. This makes capability failure modes distinct from access control failures on the underlying object, but avoids using EBADF (used for FREAD/FWRITE failure in POSIX) that makes it tricky to debug bad file descriptors (which occur more frequently when debugging capability system programs). Affected files ... .. //depot/projects/trustedbsd/capabilities/src/sys/kern/sys_capability.c#8 edit .. //depot/projects/trustedbsd/capabilities/src/sys/sys/errno.h#2 edit Differences ... ==== //depot/projects/trustedbsd/capabilities/src/sys/kern/sys_capability.c#8 (text+ko) ==== @@ -64,7 +64,7 @@ */ #include -__FBSDID("$P4: //depot/projects/trustedbsd/capabilities/src/sys/kern/sys_capability.c#7 $"); +__FBSDID("$P4: //depot/projects/trustedbsd/capabilities/src/sys/kern/sys_capability.c#8 $"); #include #include @@ -138,7 +138,7 @@ { if ((c->cap_rights | rights) != c->cap_rights) - return (EACCES); + return (ENOTCAPABLE); return (0); } ==== //depot/projects/trustedbsd/capabilities/src/sys/sys/errno.h#2 (text+ko) ==== @@ -174,7 +174,11 @@ #define EPROTO 92 /* Protocol error */ #ifndef _POSIX_SOURCE -#define ELAST 92 /* Must be equal largest errno */ +#define ENOTCAPABLE 93 /* Capabilities insufficient */ +#endif /* _POSIX_SOURCE */ + +#ifndef _POSIX_SOURCE +#define ELAST 93 /* Must be equal largest errno */ #endif /* _POSIX_SOURCE */ #ifdef _KERNEL