From owner-freebsd-hackers@FreeBSD.ORG Thu Oct 7 19:43:18 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 7BF911065670; Thu, 7 Oct 2010 19:43:18 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-pv0-f182.google.com (mail-pv0-f182.google.com [74.125.83.182]) by mx1.freebsd.org (Postfix) with ESMTP id 0C3608FC13; Thu, 7 Oct 2010 19:43:18 +0000 (UTC) Received: by pvc21 with SMTP id 21so90376pvc.13 for ; Thu, 07 Oct 2010 12:43:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=I7z8iShKZvnK/9bFcF3jQb67E4po9BygX+1MwTXjiqU=; b=Uo5Nk2c15sPWQoPHEMDjSha/8rvjKUhgSxj3h/8LMlbbR7AKQqwwZasC04Q4Dwl9/Y n8qPEhszkxzdFBxO0jSZpzjp11SL55Qpefp9Zi1CPmxXZ1hmfcPFLYu0sHqoj95EmkiI YZoUWzSlAtc8ZAobKP2bPmEqOq1nGNBn7vDM0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=QQGIVb2+5SOvNtLqDFHNzwK0sw2NFToP7ODaTTzX31HLYWM5o7d6MGxeP1Pz5lpdZP 1BH55H31jK8/6USbdPXtj321k85YWSgxF1dqr//06ClFgEjxyWDWtR3BukfrXk6LJwHk uasMv0oIKvmgRofEXL2oxWklPdG0Ru3a23dsw= MIME-Version: 1.0 Received: by 10.142.141.10 with SMTP id o10mr1041368wfd.374.1286480597600; Thu, 07 Oct 2010 12:43:17 -0700 (PDT) Received: by 10.142.222.13 with HTTP; Thu, 7 Oct 2010 12:43:17 -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 23:43:17 +0400 Message-ID: From: Sergey Kandaurov To: Jaakko Heinonen Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Alexander Best , Garrett Cooper , 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: Thu, 07 Oct 2010 19:43:18 -0000 On 7 October 2010 22:45, 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. Just for reference: this comes from NetBSD PR kern/3491 and fixed before 1.3R. I just checked arch test, and it works as expected with the change. All chflags tests from fstest suite passed as well. --=20 wbr, pluknet