Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4952477pxv; Tue, 29 Jun 2021 21:20:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDhUbtr7G4KZEcB2SUw1GHS4FRYovid8oVKa/UYQEdi9rweLBvVGpu5YZ7ypHwVzAmbjGh X-Received: by 2002:a05:6402:848:: with SMTP id b8mr43921865edz.44.1625026821677; Tue, 29 Jun 2021 21:20:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625026821; cv=none; d=google.com; s=arc-20160816; b=fgEJx2qWSYc2Gu6uJDpoaWNC+LdqrxVDDV9oV/AcV9BpKMsodWucH1za/0v5NGhzPj CxE05ZKvMHT+95oaZElwVzW7oPb7WuFLwIG7w8Rn6C9bKRq0/4QEE2B0nbaOKbe1/Z6C TJqogO1tM5pL6zndYAny4EbUmUVCBmxksj3QWRxdY6hOxj3tYX90V2JaOMh1G+VEmJxY nhwN7Buric2j3yVUJEhVn8YueFTZic/GVr70ncxXRjDDYv9XCdlpMNxpZ+Y4q+Q9MgPM d9BzYmJNTfFntdprjZ636QmQqaqE/FoQsR8aGiYkERHZk98Nz5p7GQZQn1+aZ1aj1YG9 Sknw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=NWC4ijn0LwcONb3YN8/aR0N+ZS2l6oONk8kPRdBIx1s=; b=gCzQ76hrpYNR6wqSvsXCDjLYOU+mNZIzsjETduy6EP3pXQVeVmJNvjZbf+0PEryFat Wl8/Do1UxMZIIvKiRKACjfLB8/5ZXb3Rgsnrg54jWrLgWN8cHAngbVKvCCVorzAaLmhE vdAhULYOq98DlbWq0XU5BdQ4LPAzHkc/vYEFbDSoM3FU4baunI7c4rN2cdSLItyi6g0X dOEgiRMPesQjCcgGNIRFWZg0yMftYa7fjzJIvdLF8R3QY3JhpOXR4WgI+MTTd0LCDfqv onyRVSXyqn/3redF2OM2iuG7ZlivCHOGVdd5gVzOcy1RoMQJQXPi+5Us5ewxyobV6XHZ uFTQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gv8si4663997ejc.710.2021.06.29.21.19.28; Tue, 29 Jun 2021 21:20:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233085AbhF3EPJ (ORCPT + 99 others); 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-kernel@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.