From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2E7AC11F6A for ; Wed, 30 Jun 2021 04:12:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 99D5761D28 for ; Wed, 30 Jun 2021 04:12:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233038AbhF3EPJ (ORCPT ); Wed, 30 Jun 2021 00:15:09 -0400 Received: from outgoing-auth-1.mit.edu ([18.9.28.11]:49810 "EHLO outgoing.mit.edu" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229446AbhF3EPI (ORCPT ); Wed, 30 Jun 2021 00:15:08 -0400 Received: from cwcc.thunk.org (pool-72-74-133-215.bstnma.fios.verizon.net [72.74.133.215]) (authenticated bits=0) (User authenticated as tytso@ATHENA.MIT.EDU) by outgoing.mit.edu (8.14.7/8.12.4) with ESMTP id 15U4CT7S009691 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 30 Jun 2021 00:12:29 -0400 Received: by cwcc.thunk.org (Postfix, from userid 15806) id 0BBE815C3C8E; Wed, 30 Jun 2021 00:12:28 -0400 (EDT) Date: Wed, 30 Jun 2021 00:12:28 -0400 From: "Theodore Ts'o" To: Daniel Walsh Cc: Vivek Goyal , Casey Schaufler , "Dr. David Alan Gilbert" , "Schaufler, Casey" , "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "viro@zeniv.linux.org.uk" , "virtio-fs@redhat.com" , "berrange@redhat.com" , linux-security-module , "selinux@vger.kernel.org" Subject: Re: [RFC PATCH 0/1] xattr: Allow user.* xattr on symlink/special files if caller has CAP_SYS_RESOURCE Message-ID: References: <1b446468-dcf8-9e21-58d3-c032686eeee5@redhat.com> <5d8f033c-eba2-7a8b-f19a-1005bbb615ea@schaufler-ca.com> <20210629152007.GC5231@redhat.com> <78663f5c-d2fd-747a-48e3-0c5fd8b40332@schaufler-ca.com> <20210629173530.GD5231@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Tue, Jun 29, 2021 at 04:28:24PM -0400, Daniel Walsh wrote: > All this conversation is great, and I look forward to a better solution, but > if we go back to the patch, it was to fix an issue where the kernel is > requiring CAP_SYS_ADMIN for writing user Xattrs on link files and other > special files. > > The documented reason for this is to prevent the users from using XATTRS to > avoid quota. Huh? Where is it so documented? How file systems store and account for space used by extended attributes is a file-system specific question, but presumably any way that xattr's on regular files are accounted could also be used for xattr's on special files. Also, xattr's are limited to 32k, so it's not like users can evade _that_ much quota space, at least not without it being pretty painful. (Assuming that quota is even enabled, which most of the time, it isn't.) - Ted P.S. I'll note that if ext4's ea_in_inode is enabled, for large xattr's, if you have 2 million files that all have the same 12k windows SID stored as an xattr, ext4 will store that xattr only once. Those two million files might be owned by different uids, so we made an explicit design choice not to worry about accounting for the quota for said 12k xattr value. After all, if you can save the space and access cost of 2M * 12k if each file had to store its own copy of that xattr, perhaps not including it in the quota calculation isn't that bad. :-) We also don't account for the disk space used by symbolic links (since sometimes they can be stored in the inode as fast symlinks, and sometimes they might consume a data block). But again, that's a file system specific implementation question.