Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4324981pxb; Tue, 26 Jan 2021 19:41:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzGivN1Cggox2oocj5JAQavfdJUi2DdEFwAaw5NQdHNNC3eXpYFz1KdhiAs6YbE2DxLfdv3 X-Received: by 2002:a17:906:9381:: with SMTP id l1mr5649152ejx.433.1611718884402; Tue, 26 Jan 2021 19:41:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611718884; cv=none; d=google.com; s=arc-20160816; b=TNyIj6evuFqs2DjTYW+kmK1UyhNBSXfcqnGnctdrU2k+RVy+nI4yxHkkclNWufi1cC zJ35hZhwSdlNIREyLdp3NuQgutC8T1Vs8C51DvoPk/d4Pja5WExR550r3EnhzWLqveHw stjtoe0F/F2mYIgwkSdPU3NxVK3CbryplTrnErpUZJ28SZuOJrJYJeD4EikJrucA/cQg JkSITuAqib+pZnXYy/cmaXtkT/T6m9upqW13kjC3UxzkNtQF33fsoo2S4FHg7SFMUiRF faW5APD7XWq36RpHEwrVHyI4Anv9J0gOOtz/iVgIWDkHIFwT2i4E41bvINfHiOVvO0xY KSKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=g+lH4jVBEWj7kNZTyZRP0Sg2RcVoDFoIqR+KnfPse8w=; b=Rk/CnykvOzfPE11LTsbhnVF4mHI6FFpADoQBjBXK6IS+F0tDra+t1rhknj5AF4LhwK Z60nlUMsFZi/0ggJjDe5RGgtElXzNFqO61Bqy2CDonIrRVe2e0YJ9JAP7uScYYdLFajF gT6JGJszWygMec90BnPnRPgevpVAnoxRfRNCfze8x9APVA2lPMOu5sOQ4QqE4M7VFLJB 8mpzYK+mUNqWJRou3bE/mpnITKs+zOeJewkwGN+xnJ5+DCoxbuxmSuJN6us7H1Ujyc9o E6lnkt19Rjpkm2p3Av0mHhYlcVFnXnVFjW8N4Xk0nGKvjHxkIMnSzvse9mA6Jm9VNmBj KzwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VlWJEC4m; 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 z20si329454edb.95.2021.01.26.19.40.59; Tue, 26 Jan 2021 19:41:24 -0800 (PST) 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=VlWJEC4m; 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 S2388111AbhAZGYu (ORCPT + 99 others); Tue, 26 Jan 2021 01:24:50 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:30968 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729069AbhAYNsH (ORCPT ); Mon, 25 Jan 2021 08:48:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611582376; 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=g+lH4jVBEWj7kNZTyZRP0Sg2RcVoDFoIqR+KnfPse8w=; b=VlWJEC4mD8d0eDPqV39MC/zd+DpWUbl9O2WNkupCUU+kZ+pbvav0h49c2yenR8Ap8ztbjv bND2NFzfessU59fg4N03sDwVBuDyK9knZopZohAWBYlCNFljzZ8Yqxwx9d3fY+dHps1hz4 7tWCIKe8KytFpt6yfYOBV2p5PD0BDlU= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-544-5qQoq7rPNr-djYZR3Kip7Q-1; Mon, 25 Jan 2021 08:46:12 -0500 X-MC-Unique: 5qQoq7rPNr-djYZR3Kip7Q-1 Received: by mail-qv1-f71.google.com with SMTP id m1so9186884qvp.0 for ; Mon, 25 Jan 2021 05:46:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=g+lH4jVBEWj7kNZTyZRP0Sg2RcVoDFoIqR+KnfPse8w=; b=bEA6uyrwJkTbrdy3/gZYwRRxnWAcIEmHOhe1AO//qy9bM+9YTmR17Wf9Ir9obGy/Dg sLg9Nq27Q2UR7+fNrH4XRA+D1niVaTco9xhDz5d56tUelZTEENeNMqqnD7pWO3tdwD8z L3i/GZ2iKpDuJgw6awL0K4tq2dyZFltT+A/2+Fw6l2vgajeIHAeRmgjxu+8hDV8gk1pv fORRz/s19IwO0P3Sjbh2yudg2ZZG17BqO8LZ0QCgSCX8igHuznMS7LRUEiwHfFq9b78+ HOatjcaTazgD3SHvV76+CSjuhKyGPy3W9vA4wMvYC5kBdT9x9Qkm4AGjHyK+1euQ+mrN Q4Jg== X-Gm-Message-State: AOAM531HNnuF1Qc9YhqzdmBAVo5PSVc4jgarzCyMq3zpg5JaqByR4/9M 8E5yKeMRudS1vh3GMTICpX1lbreR3+WalXfadWzQZawphXsh/eQaQdgW6IZwE2tM04M2AHCGk7z tlWE3W1SLRwF8s2Qg+lcAubiRuY95zKnzTX1hGu5d X-Received: by 2002:a05:620a:24cd:: with SMTP id m13mr708440qkn.273.1611582372375; Mon, 25 Jan 2021 05:46:12 -0800 (PST) X-Received: by 2002:a05:620a:24cd:: with SMTP id m13mr708419qkn.273.1611582372176; Mon, 25 Jan 2021 05:46:12 -0800 (PST) MIME-Version: 1.0 References: <20210119162204.2081137-1-mszeredi@redhat.com> <20210119162204.2081137-2-mszeredi@redhat.com> <20210122183141.GB81247@sequoia> In-Reply-To: From: Miklos Szeredi Date: Mon, 25 Jan 2021 14:46:01 +0100 Message-ID: Subject: Re: [PATCH 1/2] ecryptfs: fix uid translation for setxattr on security.capability To: Tyler Hicks Cc: "Eric W . Biederman" , linux-fsdevel , overlayfs , linux-security-module@vger.kernel.org, lkml , "Serge E . Hallyn" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 25, 2021 at 2:25 PM Miklos Szeredi wrote: > > On Fri, Jan 22, 2021 at 7:31 PM Tyler Hicks wrote: > > > > On 2021-01-19 17:22:03, Miklos Szeredi wrote: > > > Prior to commit 7c03e2cda4a5 ("vfs: move cap_convert_nscap() call into > > > vfs_setxattr()") the translation of nscap->rootid did not take stacked > > > filesystems (overlayfs and ecryptfs) into account. > > > > > > That patch fixed the overlay case, but made the ecryptfs case worse. > > > > Thanks for sending a fix! > > > > I know that you don't have an eCryptfs setup to test with but I'm at a > > loss about how to test this from the userns/fscaps side of things. Do > > you have a sequence of unshare/setcap/getcap commands that I can run on > > a file inside of an eCryptfs mount to verify that the bug exists after > > 7c03e2cda4a5 and then again to verify that this patch fixes the bug? > > You need two terminals: > $ = > # = root > > $ unshare -Um > $ echo $$ > > # echo "0 1000 1" > uid_map NOTE: is assumed to have uid=1000, so this and following "1000" values need to be fixed up if it's not the case. Thanks, Miklos