Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp370059pxv; Wed, 30 Jun 2021 07:28:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnl0v6i1X5dZthcQpquYhBrQIqT0rpNp7DR4kTiVTAYd5etvVBzjFsck/qxEGSwE/BGOqL X-Received: by 2002:a17:906:b191:: with SMTP id w17mr36572916ejy.10.1625063338113; Wed, 30 Jun 2021 07:28:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625063338; cv=none; d=google.com; s=arc-20160816; b=dTZj4XsMO7s40SLh2g0zhPT47mEmTdZPT0Bd6anA/iXF9RWeXnUkVrGnrQEqLi+A4H PXISzECN/bogOTRI9TdMnR3wmAuvCYIZtrOFUKHCq0VXR22Xv0pym3NN9Trb15rEvEWK SZRB43f+/i7KbK7ZeNqEMFXAXxH3bCoUAkE7h28/BJfvzV5hnrR6sO/7JGv11fCtZsac cJziweKdsVI3nIWDtdXj2Ddl2Qslqc4Hvi2VGfGYhM5q7yvFmk3WyutgB+NHoMVUnNbo rRxiWMEWtRC6YAyCMONwb8RSMdl1gdFdeNXTp1xqmpLfl5keLysT4JOJImk6KTBBn714 hhkQ== 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:dkim-signature; bh=1d2Jt0MNjAao88bTvZMUVLETujlEaYGrDFgnkx5mKjs=; b=J+JeWp1hzbb8fpzblA4KJFilS4cDi8ZFeigv69zfQHACkig8uHwYjTsoNv/HsEz/c6 Nn8sHwXrDqxh2QKObSs88ooK+rtdBCUNaGp3XzShkb76RoR/Bo1t6BrQuspdRwJJNDiV AKgmquocPWR39aI/IUXLlovV4ss+pbvkEK5nVmVEdVQxEtue3JdHbHfeYx+2S7+w8U9k 0JVr8jwUXAgp461VqxvMeEbcif5WJPlneMKJSh9PEhz8EFzXWpo7Z6oGcUBhLmpA2Byv bqxL2bHwVCKI27d3Spgw9h1k1qKYwMDljmnleZ+YcX4DG3uohhhd2Zf05FxzthSt8y2d FBXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XsZySUiH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e21si20913097edc.442.2021.06.30.07.28.34; Wed, 30 Jun 2021 07:28:58 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XsZySUiH; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235180AbhF3OaA (ORCPT + 99 others); Wed, 30 Jun 2021 10:30:00 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:41068 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235027AbhF3O37 (ORCPT ); Wed, 30 Jun 2021 10:29:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625063250; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=1d2Jt0MNjAao88bTvZMUVLETujlEaYGrDFgnkx5mKjs=; b=XsZySUiHrOdq/3U0aUKyL9byqUdWqDCuKda3m7MzqANSFOIzzOKo5xtNX6f+7ntsfOSPgU xxg7sIRQRH/sZ6x3ortWbVea19X21pgW/Dcp9q0P4fiU5g0T0Sf3gQ36UJH4+Ze8gypurc Xr7NvyuItMnAypOlPx88uWkspuecTvk= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-512-Pi9JRAE1PY6TXLuC1uOyNw-1; Wed, 30 Jun 2021 10:27:22 -0400 X-MC-Unique: Pi9JRAE1PY6TXLuC1uOyNw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EE3D110C1ADC; Wed, 30 Jun 2021 14:27:19 +0000 (UTC) Received: from horse.redhat.com (ovpn-115-222.rdu2.redhat.com [10.10.115.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id 398F660854; Wed, 30 Jun 2021 14:27:16 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id B0B8222054F; Wed, 30 Jun 2021 10:27:15 -0400 (EDT) Date: Wed, 30 Jun 2021 10:27:15 -0400 From: Vivek Goyal To: Theodore Ts'o Cc: Daniel Walsh , 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: <20210630142715.GB75386@redhat.com> References: <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: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 30, 2021 at 12:12:28AM -0400, Theodore Ts'o wrote: > 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? Its in "man xattr". David already copied pasted the relevant section in another email, so I am not doing it. > 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. That will be nice. I don't know enough about quota, but I am wondering why quota limits can't be enforced (if needed) for symlinks and special file xattrs. Thanks Vivek > > 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. >