Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp116852pxv; Wed, 30 Jun 2021 01:10:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwopmUZvkgmy05zXAKgLjzCBDUegicJmk6iJJhFi7MqqLsE7IWphefq5KJtnNzy1rJILg2R X-Received: by 2002:a02:2547:: with SMTP id g68mr7839688jag.24.1625040640052; Wed, 30 Jun 2021 01:10:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625040640; cv=none; d=google.com; s=arc-20160816; b=O3520yjCE7zH9ca1CFt5KyelLt3WjvzhlmGHoFqUiUe1F6Dl7esK/TQVLxFBCKMqLr gOK8XgfD3MTlQpjRGXPHCmrnG0Huq9/ZR3+GWg9NUQcMepvSfrkC4GpJooTC3+haYtz6 qstxDIiNmOrDtQ7hFy2JoJfPCknHo+WztYbaPcJp4ykO05WuOaRQmAxyBqW5txMHnwUE rJIXR/SErd8nHjzyxixd68ZNqB8PgIR1rOz86prCJghZE1VIPN3YXbiCl4uYvTXyqdse Ax6pTYFhhaaHxImr1dfZBWmAxURn/kqQKyZifkx7XwZSv58wdsH6D73gFy+tXvXdVjya q2QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=spXMVCuw6N13xLjcZGemYJM/fS6G+xh95O5x4vR27TA=; b=PwqdrsHA2nDvNf6tC9Pz2t3V6fbiX3NyRH+o1qVzk5sMVCrxWeB8Wpy5PguWKzXF5s ANXPS2buwFBnr7BM41dZ7baL2vkROt15jBgybniOmbBWWBRlL8S5dgRUaJY4uVJUfgme ftt2KX8dc4jzsNJJN3Al8Ss4oS2mUAyHvH7uv3hQ+1RyVu0cIbAOFUMirZMq1m8IfTEI jqmFDRh+vfim1WRNX92dLnN48GmwuS8zD68CpQBec/0tmQgndrs6XCL34PC+iBRmEAhE iOWvob3hYv/g315yOTwLheDL0HZ1JzTlrfvyfZcaagUsiobxK2jwDKqGFDpzOgpis96N hQnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OWR0TFQK; 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 p14si27128159ils.62.2021.06.30.01.10.25; Wed, 30 Jun 2021 01:10:40 -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=OWR0TFQK; 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 S233467AbhF3IKf (ORCPT + 99 others); Wed, 30 Jun 2021 04:10:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:20276 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233127AbhF3IKa (ORCPT ); Wed, 30 Jun 2021 04:10:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625040482; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=spXMVCuw6N13xLjcZGemYJM/fS6G+xh95O5x4vR27TA=; b=OWR0TFQKbwRRrRFQdmmtbq6QQrvoe53uEI+PzplIStXMHP1/mnI59qEQX0SAFdX1dXoJ76 DLqMZ0IItq4d9RNkZusg2qMIKcF+FGYWprAoYJexTl4qA15v4WA0nt4hdIMoBCXDDd06rm FlV+l+r8Hn7YKQdvHX/VfaJQWqeRO2U= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-182-q0bTb4EZPTik-u2Y84fIuQ-1; Wed, 30 Jun 2021 04:08:00 -0400 X-MC-Unique: q0bTb4EZPTik-u2Y84fIuQ-1 Received: by mail-wr1-f70.google.com with SMTP id x8-20020a5d54c80000b029012583535285so561234wrv.8 for ; Wed, 30 Jun 2021 01:08:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=spXMVCuw6N13xLjcZGemYJM/fS6G+xh95O5x4vR27TA=; b=Hyz+DklzgAuoq+ThwtD82/PUIQw/OQicFvTeTg1BDB053rVlI7qRRqGJJ9amde9rNR ik0U10GaoPsW9/3a/MptDej2egjrIUNGz6V+lSwG8EhyVoquTHkFrD/zE9fSEDQ+f1B5 XROs18zYTVm4I2yozhOOTLeiT/ZM1ANwtLIn+U2QqhRTyZ25UZ/gDL9GPJei1YCaB/7m rUGs/IOTehDZcomUDzGej4ij19arXdiUf8YvbeiCVFPLSCx+ZYZ3I0r6jKCxtLKJL8by qqfU2dWsjZc3h8iNADw0JFU/g7XGOLbgx5PnOqks7rSql3SzcRlC+SNeFs96MiXmo8bc OmAA== X-Gm-Message-State: AOAM530KNNniCwNounjLjM6wvByVKILaCw1ckV+4EYnBe7ZAdc7gejpt AMpnZCvsU6XOZj3hcCQSX2t5tIHTl3185krij/vg/BQZ2Qp0yPty94LnrZHXktOOPQNosi4OJ2f 9wh2XSZrXA1bbxmr70lObjITh X-Received: by 2002:a05:600c:4f8a:: with SMTP id n10mr3045913wmq.11.1625040479481; Wed, 30 Jun 2021 01:07:59 -0700 (PDT) X-Received: by 2002:a05:600c:4f8a:: with SMTP id n10mr3045884wmq.11.1625040479197; Wed, 30 Jun 2021 01:07:59 -0700 (PDT) Received: from work-vm (cpc109021-salf6-2-0-cust453.10-2.cable.virginm.net. [82.29.237.198]) by smtp.gmail.com with ESMTPSA id m7sm22064425wrv.35.2021.06.30.01.07.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Jun 2021 01:07:58 -0700 (PDT) Date: Wed, 30 Jun 2021 09:07:56 +0100 From: "Dr. David Alan Gilbert" To: Theodore Ts'o Cc: Daniel Walsh , Vivek Goyal , Casey Schaufler , "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: <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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/2.0.7 (2021-05-04) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Theodore Ts'o (tytso@mit.edu) 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? man xattr(7): The file permission bits of regular files and directories are interpreted differently from the file permission bits of special files and symbolic links. For regular files and directories the file permission bits define ac‐ cess to the file's contents, while for device special files they define access to the device described by the special file. The file permissions of symbolic links are not used in access checks. *** These differences would al‐ low users to consume filesystem resources in a way not controllable by disk quotas for group or world writable special files and directories.**** ***For this reason, user extended attributes are allowed only for regular files and directories ***, and access to user extended attributes is restricted to the owner and to users with appropriate capabilities for directories with the sticky bit set (see the chmod(1) manual page for an explanation of the sticky bit). (***'s my addition) Dave > 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. > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK