Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4702498pxv; Tue, 29 Jun 2021 13:30:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJx8+sTDGF+/LbRa4E3Ry8eWxQHfBzdPsupWtme4lmJ0FhyLWaUP7Nhc4801op8eZtitAR X-Received: by 2002:a17:907:2d86:: with SMTP id gt6mr1547199ejc.428.1624998632800; Tue, 29 Jun 2021 13:30:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624998632; cv=none; d=google.com; s=arc-20160816; b=YP9nsC1U5vqPv1jEZ8F2hDqpXg4FZzuha2fDdz0c9QMw+ioBX5gKdVWR3TKEcgilnZ NXWQ+UnJILieSjj0qc0ivC6oOV3m6jpj39OYuhOXyp9x/uwR1GZ9nrQe39ZqXabRl1xl 0SKK8mmlQceZvzJCdDe9sPELBaNKoNaagJPpGSPFcqSmmhu6hE8TXiH64LHH8UHMxUkt kYOjaXkJchwt2po40koO9D/03BOYbbwfUUd8N7Q3eymExs0m/Jb2H50fOIHUCYhqx2D9 iM4BsXiUsE+WtgE+WXHpFAFvVZkWY2OURfJBs4+L3ZJFa41/j+zpBTUBZRdj3dBqjth9 XZBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:reply-to:dkim-signature; bh=Qe7cO7mpeKYSPAW3JclQzTAT82wV6nS1Y2KDeR28ebA=; b=ySgGJdgmv+5eRbdSNeZ6VRjCStj00sgr42gJveZziYCgbQcIV7+hDx9v8ixx1Q4qeK ee4L4iwujn69T4UDuK5nWlMELYZVMuMhgiZWQ/ecnvey+IihUBuxK/CaEW3l8jwkT+36 4p2pe5eOHoSFFXmOO5oTAvAJPET83coG2cnxqXs5T02cIqdHK/ViQ2T8RizWeN0TqwcY fQY7PStkjObPfV3oy3AbzWvqencgIqkdt7HGfRrHwjLRDqk34W3Az/MV6OH9UpK1PUA2 w7wdCYvq7Ty5psSn/3H4qdB8BkkUUQo5tu2r34F1sbASTCPK9xF0CDFnZKZ9hNUrTCYA UWtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Qwkj2ZCO; 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 og29si17680422ejc.393.2021.06.29.13.30.06; Tue, 29 Jun 2021 13:30:32 -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=Qwkj2ZCO; 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 S235469AbhF2UbC (ORCPT + 99 others); Tue, 29 Jun 2021 16:31:02 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:50389 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235463AbhF2Ua5 (ORCPT ); Tue, 29 Jun 2021 16:30:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624998509; h=from:from:reply-to: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=Qe7cO7mpeKYSPAW3JclQzTAT82wV6nS1Y2KDeR28ebA=; b=Qwkj2ZCOJ9C3FlX17w6FQxH4NS6a9XZaXzmCMg8HMEjdANYUPIMPsTWuPuU4dOB5MVY1qc xQqSHfZg628qBS7mQEIx93kF2XwmpyCq4SfQIqz5I9I16G6ARIxBaoLMjK1j3smCQq1c/K nJkuHODB0I/sWK1g3NONzfjvJ4G7Paw= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-320-1cSQ2tOYO8GOTLEkISsagg-1; Tue, 29 Jun 2021 16:28:28 -0400 X-MC-Unique: 1cSQ2tOYO8GOTLEkISsagg-1 Received: by mail-qv1-f70.google.com with SMTP id ei5-20020ad45a050000b029027c5382c633so20268323qvb.3 for ; Tue, 29 Jun 2021 13:28:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:reply-to:subject:to:cc:references:from :organization:message-id:date:user-agent:mime-version:in-reply-to :content-transfer-encoding:content-language; bh=Qe7cO7mpeKYSPAW3JclQzTAT82wV6nS1Y2KDeR28ebA=; b=LGks1k18H2Mq3WFzD6I4rgdAhAU7OIPj/mmD+zzgTA7p6JfQPeScqF7udqJYne13B9 wcIUGKpioyGHPExvHZdN7ayEneNJzmk+I4AEYy7O+xc2Cw2psrzPZSQFnKHkpjRBJqKx RZBSVUq4t21+g+1M0e1h0s0WVtXaPuZh1kNKXSuIwHS1gMaM573dl2csJQ6SmbuWd9sX yLCZdYRzi8+PJNmQwR+fyAinusID363kfVPILk9BZ+DHlpJlytkpsVMcbyuuJwTcF/HB lxrQs2DC5umJVhD8s4P80DmmqLmJaEkCZC5eZm8RFA2TUBI9H0gUUb3w5Z7lSwnO7C4l UK0Q== X-Gm-Message-State: AOAM532FBpICdzfulLi8Ys4drOYwpPTH785V/eWcQ4xM+bv8l+Tpiasg KSG9KTMyP/wdzj113BnOroAwOdaqxcN/uk6nb4UE7TR/cv6T/VmCJw4fcm3G5dfTOpaT/KkXAlu M37JFOTlsfm+C8nNDM+CQjBuu X-Received: by 2002:a37:5646:: with SMTP id k67mr32407685qkb.333.1624998507521; Tue, 29 Jun 2021 13:28:27 -0700 (PDT) X-Received: by 2002:a37:5646:: with SMTP id k67mr32407667qkb.333.1624998507292; Tue, 29 Jun 2021 13:28:27 -0700 (PDT) Received: from localhost.localdomain (cpe-74-65-150-180.maine.res.rr.com. [74.65.150.180]) by smtp.gmail.com with ESMTPSA id k19sm8094710qta.90.2021.06.29.13.28.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 29 Jun 2021 13:28:26 -0700 (PDT) Reply-To: dwalsh@redhat.com Subject: Re: [RFC PATCH 0/1] xattr: Allow user.* xattr on symlink/special files if caller has CAP_SYS_RESOURCE To: Vivek Goyal , Casey Schaufler Cc: "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" References: <20210628131708.GA1803896@redhat.com> <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> From: Daniel Walsh Organization: Red Hat Message-ID: Date: Tue, 29 Jun 2021 16:28:24 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210629173530.GD5231@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/29/21 13:35, Vivek Goyal wrote: > On Tue, Jun 29, 2021 at 09:13:48AM -0700, Casey Schaufler wrote: >> On 6/29/2021 8:20 AM, Vivek Goyal wrote: >>> On Tue, Jun 29, 2021 at 07:38:15AM -0700, Casey Schaufler wrote: >>> >>> [..] >>>>>>>> User xattrs are less protected than security xattrs. You are exposing the >>>>>>>> security xattrs on the guest to the possible whims of a malicious, unprivileged >>>>>>>> actor on the host. All it needs is the right UID. >>>>>>> Yep, we realise that; but when you're mainly interested in making sure >>>>>>> the guest can't attack the host, that's less worrying. >>>>>> That's uncomfortable. >>>>> Why exactly? >>>> If a mechanism is designed with a known vulnerability you >>>> fail your validation/evaluation efforts. >>> We are working with the constraint that shared directory should not be >>> accessible to unpriviliged users on host. And with that constraint, what >>> you are referring to is not a vulnerability. >> Sure, that's quite reasonable for your use case. It doesn't mean >> that the vulnerability doesn't exist, it means you've mitigated it. >> >> >>>> Your mechanism is >>>> less general because other potential use cases may not be >>>> as cavalier about the vulnerability. >>> Prefixing xattrs with "user.virtiofsd" is just one of the options. >>> virtiofsd has the capability to prefix "trusted.virtiofsd" as well. >>> We have not chosen that because we don't want to give it CAP_SYS_ADMIN. >>> >>> So other use cases which don't like prefixing "user.virtiofsd", can >>> give CAP_SYS_ADMIN and work with it. >>> >>>> I think that you can >>>> approach this differently, get a solution that does everything >>>> you want, and avoid the known problem. >>> What's the solution? Are you referring to using "trusted.*" instead? But >>> that has its own problem of giving CAP_SYS_ADMIN to virtiofsd. >> I'm coming to the conclusion that xattr namespaces, analogous >> to user namespaces, are the correct solution. They generalize >> for multiple filesystem and LSM use cases. The use of namespaces >> is well understood, especially in the container community. It >> looks to me as if it would address your use case swimmingly. > Even if xattrs were namespaced, I am not sure it solves the issue > of unpriviliged UID being able to modify security xattrs of file. > If it happens to be correct UID, it should be able to spin up a > user namespace and modify namespaced xattrs? > > Anyway, once namespaced xattrs are available, I will gladly make use > of it. But that probably should not be a blocker for this patch. > > Vivek > 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. The CAP_SYS_RESOURCE capability is denfined to allow processes with this capability to ignore quota. This PR allows processes with CAP_SYS_RESOURCE to create user Xattrs. To me this makes sense. Is there any argument against this?