From owner-freebsd-standards@FreeBSD.ORG Wed May 28 11:35:19 2003 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 405D637B404; Wed, 28 May 2003 11:35:19 -0700 (PDT) Received: from server4.engr.scu.edu (server4.engr.scu.edu [129.210.16.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id A6C4343F85; Wed, 28 May 2003 11:35:18 -0700 (PDT) (envelope-from dclark@applmath.scu.edu) Received: from dc.engr.scu.edu (dclark@hpux44.dc.engr.scu.edu [129.210.16.44]) by server4.engr.scu.edu (8.10.2/8.10.2) with ESMTP id h4SHJVQ28323; Wed, 28 May 2003 10:19:31 -0700 Sender: dclark@applmath.scu.edu Message-ID: <3ED4EFA2.E5FAAD1F@dc.engr.scu.edu> Date: Wed, 28 May 2003 10:19:30 -0700 From: "Dorr H. Clark" Organization: SCU School of Engineering X-Mailer: Mozilla 4.75 [en] (X11; U; HP-UX B.10.20 9000/782) X-Accept-Language: en MIME-Version: 1.0 To: freebsd-gnats-submit@FreeBSD.org, behanna@zbzoom.net, freebsd-standards@FreeBSD.org Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: here's an unnecessary fix (Re: standards/44425: getcwd() succeedseven if current dir has perm 000) X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 May 2003 18:35:19 -0000 The bug 44425 has a straightforward fix, but our research indicates that the fix is not required by the standard. The man page indicates that getcwd() conforms to POSIX.1, which we quote: POSIX.1 section B.5.2.2 : "If a program is operating in a directory where some (grand)parent directory does not permit reading, getcwd() MAY fail, ... " (emphasis added) In otherwords, the behavior described in 44425 is acceptable. We have implemented a fix anyway. In a situation like this, where we're adding a VOP interface into a system call (see below), performance should also be considered. The routine getcwd() is not typically a performance critical component of the file system code, but a clear case exists for keeping the code the way it is instead of applying the enclosed patch. Care also should be taken that there are no unexpected side effects for programs which rely on the standard for normal operation. Note: If you're really interested in file system restricted access for particular users, you might check out the "jail" functionality. What follows is the actual fix. Fix applies to src/sys/kern/vfs_cache.c, please note that our implementation is applied to the 4.7 baseline. --- vfs_cache.c_orig Wed Apr 30 05:43:20 2003 +++ vfs_cache.c Tue May 13 08:45:21 2003 @@ -546,6 +546,7 @@ struct filedesc *fdp; struct namecache *ncp; struct vnode *vp; + struct vattr vattr; /* attributes of vnode */ numcwdcalls++; if (disablecwd) @@ -579,6 +580,22 @@ free(buf, M_TEMP); return (ENOENT); } + + if ((error = VOP_GETATTR(ncp->nc_vp, &vattr, p->p_ucred, p)) != 0) { + free(buf, M_TEMP); + return(error); + } + + + /* check if read or search permissions are denied, if so, then + return an EACCES error and exit. + */ + + if (!(vattr.va_mode & VEXEC) || (!(vattr.va_mode & VREAD))) { + free(buf, M_TEMP); + return(EACCES); + } + if (ncp->nc_dvp != vp->v_dd) { numcwdfail3++; free(buf, M_TEMP); Kalpana Pathak, engineer Dorr H. Clark, advisor COEN 284, Operating Systems Case Study Santa Clara University From owner-freebsd-standards@FreeBSD.ORG Wed May 28 11:40:14 2003 Return-Path: Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B992637B401 for ; Wed, 28 May 2003 11:40:14 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3A24C43F3F for ; Wed, 28 May 2003 11:40:14 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h4SIeEUp011506 for ; Wed, 28 May 2003 11:40:14 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h4SIeEe1011505; Wed, 28 May 2003 11:40:14 -0700 (PDT) Date: Wed, 28 May 2003 11:40:14 -0700 (PDT) Message-Id: <200305281840.h4SIeEe1011505@freefall.freebsd.org> To: freebsd-standards@FreeBSD.org From: "Dorr H. Clark" Subject: here's an unnecessary fix (Re: standards/44425: getcwd() succeedseven if current dir has perm 000) X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: "Dorr H. Clark" List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 May 2003 18:40:15 -0000 The following reply was made to PR standards/44425; it has been noted by GNATS. From: "Dorr H. Clark" To: freebsd-gnats-submit@FreeBSD.org, behanna@zbzoom.net, freebsd-standards@FreeBSD.org Cc: Subject: here's an unnecessary fix (Re: standards/44425: getcwd() succeeds even if current dir has perm 000) Date: Wed, 28 May 2003 10:19:30 -0700 The bug 44425 has a straightforward fix, but our research indicates that the fix is not required by the standard. The man page indicates that getcwd() conforms to POSIX.1, which we quote: POSIX.1 section B.5.2.2 : "If a program is operating in a directory where some (grand)parent directory does not permit reading, getcwd() MAY fail, ... " (emphasis added) In otherwords, the behavior described in 44425 is acceptable. We have implemented a fix anyway. In a situation like this, where we're adding a VOP interface into a system call (see below), performance should also be considered. The routine getcwd() is not typically a performance critical component of the file system code, but a clear case exists for keeping the code the way it is instead of applying the enclosed patch. Care also should be taken that there are no unexpected side effects for programs which rely on the standard for normal operation. Note: If you're really interested in file system restricted access for particular users, you might check out the "jail" functionality. What follows is the actual fix. Fix applies to src/sys/kern/vfs_cache.c, please note that our implementation is applied to the 4.7 baseline. --- vfs_cache.c_orig Wed Apr 30 05:43:20 2003 +++ vfs_cache.c Tue May 13 08:45:21 2003 @@ -546,6 +546,7 @@ struct filedesc *fdp; struct namecache *ncp; struct vnode *vp; + struct vattr vattr; /* attributes of vnode */ numcwdcalls++; if (disablecwd) @@ -579,6 +580,22 @@ free(buf, M_TEMP); return (ENOENT); } + + if ((error = VOP_GETATTR(ncp->nc_vp, &vattr, p->p_ucred, p)) != 0) { + free(buf, M_TEMP); + return(error); + } + + + /* check if read or search permissions are denied, if so, then + return an EACCES error and exit. + */ + + if (!(vattr.va_mode & VEXEC) || (!(vattr.va_mode & VREAD))) { + free(buf, M_TEMP); + return(EACCES); + } + if (ncp->nc_dvp != vp->v_dd) { numcwdfail3++; free(buf, M_TEMP); Kalpana Pathak, engineer Dorr H. Clark, advisor COEN 284, Operating Systems Case Study Santa Clara University From owner-freebsd-standards@FreeBSD.ORG Wed May 28 15:20:13 2003 Return-Path: Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 086A437B401 for ; Wed, 28 May 2003 15:20:13 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 90CE443F85 for ; Wed, 28 May 2003 15:20:12 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h4SMKCUp033305 for ; Wed, 28 May 2003 15:20:12 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h4SMKCkw033304; Wed, 28 May 2003 15:20:12 -0700 (PDT) Date: Wed, 28 May 2003 15:20:12 -0700 (PDT) Message-Id: <200305282220.h4SMKCkw033304@freefall.freebsd.org> To: freebsd-standards@FreeBSD.org From: Craig Rodrigues Subject: Re: standards/50523: Deprecate , add X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Craig Rodrigues List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 May 2003 22:20:13 -0000 The following reply was made to PR standards/50523; it has been noted by GNATS. From: Craig Rodrigues To: freebsd-gnats-submit@freebsd.org Cc: Subject: Re: standards/50523: Deprecate , add Date: Wed, 28 May 2003 18:18:31 -0400 Hi, I think that this PR can be closed. kan@ committed the following to -CURRENT: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=1377248+0+archive/2003/cvs-all/20030427.cvs-all -- Craig Rodrigues http://home.attbi.com/~rodrigc rodrigc@attbi.com From owner-freebsd-standards@FreeBSD.ORG Wed May 28 15:30:17 2003 Return-Path: Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 73E2737B401 for ; Wed, 28 May 2003 15:30:17 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0720643F93 for ; Wed, 28 May 2003 15:30:17 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h4SMUGUp033719 for ; Wed, 28 May 2003 15:30:16 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h4SMUGvP033718; Wed, 28 May 2003 15:30:16 -0700 (PDT) Date: Wed, 28 May 2003 15:30:16 -0700 (PDT) Message-Id: <200305282230.h4SMUGvP033718@freefall.freebsd.org> To: freebsd-standards@FreeBSD.org From: Craig Rodrigues Subject: Re: standards/50582: Define WCHAR_MIN and WCHAR_MAX in X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Craig Rodrigues List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 May 2003 22:30:17 -0000 The following reply was made to PR standards/50582; it has been noted by GNATS. From: Craig Rodrigues To: freebsd-gnats-submit@freebsd.org Cc: Subject: Re: standards/50582: Define WCHAR_MIN and WCHAR_MAX in Date: Wed, 28 May 2003 18:21:52 -0400 Hi, This PR can be closed. kan@ committed the following: kan 2003/04/28 15:40:05 PDT FreeBSD src repository Modified files: include wchar.h Log: Add definitions for WCHAR_MIN and WCHAR_MAX. Revision Changes Path 1.35 +6 -0 src/include/wchar.h -- Craig Rodrigues http://home.attbi.com/~rodrigc rodrigc@attbi.com From owner-freebsd-standards@FreeBSD.ORG Thu May 29 00:04:13 2003 Return-Path: Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 26AEE37B401; Thu, 29 May 2003 00:04:13 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id A16A043F93; Thu, 29 May 2003 00:04:12 -0700 (PDT) (envelope-from maxim@FreeBSD.org) Received: from freefall.freebsd.org (maxim@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h4T74CUp078607; Thu, 29 May 2003 00:04:12 -0700 (PDT) (envelope-from maxim@freefall.freebsd.org) Received: (from maxim@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h4T74AOO078603; Thu, 29 May 2003 00:04:10 -0700 (PDT) Date: Thu, 29 May 2003 00:04:10 -0700 (PDT) From: Maxim Konovalov Message-Id: <200305290704.h4T74AOO078603@freefall.freebsd.org> To: rodrigc@attbi.com, maxim@FreeBSD.org, freebsd-standards@FreeBSD.org Subject: Re: standards/50582: Define WCHAR_MIN and WCHAR_MAX in X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 May 2003 07:04:13 -0000 Synopsis: Define WCHAR_MIN and WCHAR_MAX in State-Changed-From-To: open->closed State-Changed-By: maxim State-Changed-When: Thu May 29 00:03:43 PDT 2003 State-Changed-Why: Fixed, thanks. http://www.freebsd.org/cgi/query-pr.cgi?pr=50582 From owner-freebsd-standards@FreeBSD.ORG Thu May 29 00:04:58 2003 Return-Path: Delivered-To: freebsd-standards@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0B1AF37B401; Thu, 29 May 2003 00:04:58 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9CC3C43F3F; Thu, 29 May 2003 00:04:57 -0700 (PDT) (envelope-from maxim@FreeBSD.org) Received: from freefall.freebsd.org (maxim@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h4T74vUp078654; Thu, 29 May 2003 00:04:57 -0700 (PDT) (envelope-from maxim@freefall.freebsd.org) Received: (from maxim@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h4T74v4W078650; Thu, 29 May 2003 00:04:57 -0700 (PDT) Date: Thu, 29 May 2003 00:04:57 -0700 (PDT) From: Maxim Konovalov Message-Id: <200305290704.h4T74v4W078650@freefall.freebsd.org> To: rodrigc@attbi.com, maxim@FreeBSD.org, freebsd-standards@FreeBSD.org Subject: Re: standards/50523: Deprecate , add X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 May 2003 07:04:58 -0000 Synopsis: Deprecate , add State-Changed-From-To: open->closed State-Changed-By: maxim State-Changed-When: Thu May 29 00:04:26 PDT 2003 State-Changed-Why: Fixed, thanks. http://www.freebsd.org/cgi/query-pr.cgi?pr=50523