From owner-freebsd-hackers@FreeBSD.ORG Fri Oct 8 00:42:58 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 581AE1065673; Fri, 8 Oct 2010 00:42:58 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id D79578FC0C; Fri, 8 Oct 2010 00:42:57 +0000 (UTC) Received: by iwn8 with SMTP id 8so635427iwn.13 for ; Thu, 07 Oct 2010 17:42:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=GmPi5N6zrim5fybXg/tHjbBpS6fhAtkpQP9bRH4dbUM=; b=LCxqRJIAigt5sXmaN8SrPAdyi+7QxJSWAEUdSK9X+6H8eOpW5OyftNszIBHCnPTp25 bAiDlFMNgYMdt33pkhJlQJJLCEBzKuBWB3DI3/g4B2ceYqdBiRh5167Jvt+I84qMjaXz 3y/TFDsqh7JRBQHSXdSSs39l980rkqsTqywt8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=Hvs8zH5dOqE5gFN3t1jKKTXYBw92Nl81qrXp8/ytSy7RYAyvahna5ULm6SJRLL2vHG 4o7r82Zcko5jZNx5/6cSmC4J8ynPCTTbs4bAAfM2YM5z3vSKsAD00RJF9VsLMLiwEcBn 4aT1hmQkCVKPv9gNg2Epw86oT2tdWaWjBie/Y= MIME-Version: 1.0 Received: by 10.231.39.201 with SMTP id h9mr1728412ibe.27.1286498577514; Thu, 07 Oct 2010 17:42:57 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.231.184.3 with HTTP; Thu, 7 Oct 2010 17:42:57 -0700 (PDT) In-Reply-To: <20101007184549.GA76070@a91-153-123-205.elisa-laajakaista.fi> References: <20101005235054.GA45827@freebsd.org> <20101006173522.GA92402@freebsd.org> <20101007184549.GA76070@a91-153-123-205.elisa-laajakaista.fi> Date: Thu, 7 Oct 2010 17:42:57 -0700 X-Google-Sender-Auth: 5RIdEXqW46qVz3zfTSMEIWIV5J0 Message-ID: From: Garrett Cooper To: Jaakko Heinonen Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Alexander Best , freebsd-hackers@freebsd.org Subject: Re: issue with unsetting 'arch' flag X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Oct 2010 00:42:58 -0000 On Thu, Oct 7, 2010 at 11:45 AM, Jaakko Heinonen wrote: > On 2010-10-06, Alexander Best wrote: >> $ sudo rm -d /tmp/chflags.XXXXXX >> $ tmpfile=3D`mktemp /tmp/chflags.XXXXXX` >> $ sudo chflags arch $tmpfile >> $ chflags noarch $tmpfile >> >> is what's causing the problem. the last chflags call should fail, but it >> doesn't. > > Here is a patch for UFS: > > %%% > Index: sys/ufs/ufs/ufs_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 > --- sys/ufs/ufs/ufs_vnops.c =A0 =A0 (revision 213507) > +++ sys/ufs/ufs/ufs_vnops.c =A0 =A0 (working copy) > @@ -556,6 +556,9 @@ ufs_setattr(ap) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0& (SF_NOUNLINK | S= F_IMMUTABLE | SF_APPEND) || > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(vap->va_flags & U= F_SETTABLE) !=3D vap->va_flags) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (EP= ERM); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if ((ip->i_flags & SF_SETTA= BLE) !=3D > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (vap->va_flags & SF= _SETTABLE)) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (EPE= RM); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ip->i_flags &=3D SF_SETTAB= LE; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ip->i_flags |=3D (vap->va_= flags & UF_SETTABLE); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0DIP_SET(ip, i_flags, ip->i= _flags); > %%% > > The patch has a potential to break something if someone assumes that > non-super-user can modify UF_SETTABLE flags with the SF_SETTABLE part > set to zero. However with a quick peek this seems to be what NetBSD > does. This seems ok in terms of the original issue that Alexander reported. Thanks, -Garrett