From owner-svn-src-head@FreeBSD.ORG Wed Nov 4 18:16:13 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B1F61065670; Wed, 4 Nov 2009 18:16:13 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mx1.wheel.pl (grom.wheel.pl [91.121.70.66]) by mx1.freebsd.org (Postfix) with ESMTP id 94E028FC22; Wed, 4 Nov 2009 18:16:12 +0000 (UTC) Received: from localhost (unknown [10.10.2.1]) by mx1.wheel.pl (Postfix) with ESMTP id D9833C314; Wed, 4 Nov 2009 19:00:46 +0100 (CET) X-Virus-Scanned: amavisd-new at mx1.wheel.pl Received: from mx1.wheel.pl ([10.10.2.1]) by localhost (mx1.wheel.pl [10.10.2.1]) (amavisd-new, port 10024) with ESMTP id LY3EAep3v02M; Wed, 4 Nov 2009 19:00:45 +0100 (CET) Received: from mail.wheel.pl (ghf58.internetdsl.tpnet.pl [83.12.187.58]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.wheel.pl (Postfix) with ESMTPS id 4298CC30E; Wed, 4 Nov 2009 19:00:45 +0100 (CET) Received: from localhost (unknown [10.0.2.3]) by mail.wheel.pl (Postfix) with ESMTP id 507B13E3FE; Wed, 4 Nov 2009 19:00:44 +0100 (CET) Received: from mail.wheel.pl ([10.0.2.3]) by localhost (mx2.wheel.pl [10.0.2.3]) (amavisd-new, port 10024) with ESMTP id e0YDNhoKu7RA; Wed, 4 Nov 2009 19:00:41 +0100 (CET) Received: from [192.168.1.100] (45.81.datacomsa.pl [195.34.81.45]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.wheel.pl (Postfix) with ESMTP id 717063E3F7; Wed, 4 Nov 2009 19:00:40 +0100 (CET) Mime-Version: 1.0 (Apple Message framework v1076) Content-Type: text/plain; charset=iso-8859-2; format=flowed; delsp=yes From: =?iso-8859-2?Q?Edward_Tomasz_Napiera=B3a?= In-Reply-To: <20091104070427.GE2073@garage.freebsd.pl> Date: Wed, 4 Nov 2009 19:00:38 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <32B76852-3EA3-4814-A8B8-954CC510DAA3@FreeBSD.org> References: <200911040648.nA46mYrb021862@svn.freebsd.org> <20091104070427.GE2073@garage.freebsd.pl> To: Pawel Jakub Dawidek X-Mailer: Apple Mail (2.1076) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r198874 - head/sys/kern X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Nov 2009 18:16:13 -0000 Wiadomo=B6=E6 napisana przez Pawel Jakub Dawidek w dniu 2009-11-04, o =20= godz. 08:04: > On Wed, Nov 04, 2009 at 06:48:34AM +0000, Edward Tomasz Napierala =20 > wrote: >> Author: trasz >> Date: Wed Nov 4 06:48:34 2009 >> New Revision: 198874 >> URL: http://svn.freebsd.org/changeset/base/198874 >> >> Log: >> Make sure we don't end up with VAPPEND without VWRITE, if someone =20= >> calls open(2) >> like this: open(..., O_APPEND). >> >> Modified: >> head/sys/kern/vfs_vnops.c >> >> Modified: head/sys/kern/vfs_vnops.c >> =3D=20 >> =3D=20 >> =3D=20 >> =3D=20 >> =3D=20 >> =3D=20 >> =3D=20 >> =3D=20 >> =3D=20 >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> --- head/sys/kern/vfs_vnops.c Wed Nov 4 06:47:14 2009 = (r198873) >> +++ head/sys/kern/vfs_vnops.c Wed Nov 4 06:48:34 2009 = (r198874) >> @@ -213,7 +213,7 @@ restart: >> if (fmode & FEXEC) >> accmode |=3D VEXEC; >> if (fmode & O_APPEND) >> - accmode |=3D VAPPEND; >> + accmode |=3D VWRITE | VAPPEND; >> #ifdef MAC >> error =3D mac_vnode_check_open(cred, vp, accmode); >> if (error) > > Why? If someone does O_APPEND only we don't want to give him write > access... As it is now, VAPPEND is not a real V* flag - it's a kind of modifier =20= to VWRITE. Which means that it doesn't really make sense, from the conceptual =20 point of view, to have VAPPEND without VWRITE being set at the same time. This =20 doesn't break things right now - at least I don't know about any such breakage - but =20= in the future I'd like to have a few KASSERTs to verify that VAPPEND is never =20= specified without VWRITE, just to make sure something unexpected doesn't happen =20= somewhere. As it is now, doing open(..., O_APPEND) will result in a =20 filedescriptor open for... reading. So, the change above would change the behaviour. =20 What about something like this instead: Index: vfs_vnops.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- vfs_vnops.c (revision 198876) +++ vfs_vnops.c (working copy) @@ -212,7 +212,7 @@ accmode |=3D VREAD; if (fmode & FEXEC) accmode |=3D VEXEC; - if (fmode & O_APPEND) + if ((fmode & O_APPEND) && (fmode & FWRITE)) accmode |=3D VAPPEND; #ifdef MAC error =3D mac_vnode_check_open(cred, vp, accmode); -- If you cut off my head, what would I say? Me and my head, or me and =20 my body?