From owner-svn-src-projects@freebsd.org Tue May 7 14:18:36 2019 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6DF215886EE for ; Tue, 7 May 2019 14:18:36 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail106.syd.optusnet.com.au (mail106.syd.optusnet.com.au [211.29.132.42]) by mx1.freebsd.org (Postfix) with ESMTP id 324FA8ADE7; Tue, 7 May 2019 14:18:35 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail106.syd.optusnet.com.au (Postfix) with ESMTPS id 2B59E3DB55B; Wed, 8 May 2019 00:18:31 +1000 (AEST) Date: Wed, 8 May 2019 00:18:30 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alan Somers cc: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: Re: svn commit: r347217 - in projects/fuse2: sys/fs/fuse tests/sys/fs/fusefs In-Reply-To: <201905070127.x471ROvf000119@repo.freebsd.org> Message-ID: <20190507231529.I1127@besplex.bde.org> References: <201905070127.x471ROvf000119@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 cx=a_idp_d a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=_Yn_TPK7BCXogLAqghoA:9 a=CjuIK1q_8ugA:10 X-Rspamd-Queue-Id: 324FA8ADE7 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.98 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; NEURAL_HAM_SHORT(-0.98)[-0.982,0] X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 May 2019 14:18:37 -0000 On Tue, 7 May 2019, Alan Somers wrote: > Log: > fusefs: allow the null chown and null chgrp > > Even an unprivileged user should be able to chown a file to its current > owner, or chgrp it to its current group. Those are no-ops. ffs allows this too, but POSIX seems to require appropriate privilege even for null changes. Its DESCRIPTION section says "Changing the user ID is restricted to processes with appropriate privileges." It doesn't formally define "Changing", so this can be read as not restricting null changes. However, its ERRORS section says that chown() shall fail with errno [EPERM] if the euid doesn't match the owner of the file or the calling process doesn't have appropriate privilege (note: nothing about the null change where only the new and old owners of the file match). Most other attribute-setting syscalls don't allow null changes without appropriate privilege. E.g., in ffs: - chflags() requires VADMIN privilege - truncate() requires write privilege (this seems to be only checked for at the vfs level, where the nullness of a truncation is not easy to determine) - utimes() and friends require VDMIN privilege or write privilege to set the current time (with the same layering as for truncate(), so is hard to change) - chmod() requires VDMIN privilege according to the comment, but VWRITE_ACL privilege according to the code. Ownership and other attributes are also hard to handle for file systems that don't support them. I only care about this for msdosfs. msdosfs has fake file ids, but can have only 1 uid per file amd this often doesn't match the euid, and even root can't change it. File ids are also used for VADMIN checks, so tend to cause failures to set even unimportant attributes like file times when the setting is possible. But some impossible settings are silently ignored or silently adjusted to possible settings. E.g., for file times, most successful settings lose precision. Ownership and other attributes are even harder to handle for file systems that have more of them than vfs supports. Even for msdosfs, many attributes were not reflected in file flags until a few years ago, and file times for directories are still broken (by reading and writing the times to the wrong alias -- the "." entry -- in msdosfs. Only msdosfs finds times there, and msdosfs doesn't find times from the correct alias). ACLs are too complicated for me, even without the problem of translating them. fuse has the larger problem of having to implement identical mishandling of attributes for all file systems that it supports. Bruce