Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2521731pxu; Mon, 7 Dec 2020 08:38:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJyArymJnn0x0A+nUGOOM7VKGfJC1GZkxZUWhkjz+neHLmi3iwvRqTg7EPekWsGsms5B8WNu X-Received: by 2002:a17:906:3b55:: with SMTP id h21mr19584997ejf.184.1607359100896; Mon, 07 Dec 2020 08:38:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607359100; cv=none; d=google.com; s=arc-20160816; b=JuUvuD2dDgkTqhywCH7kOIliU1rQio4WN7/wwPC5Hq2qlJSzYZtubjGurjfasFpjL7 DDWF1dUIeUKUSdYWzdaxINX+fe8ziQnioiimuEhxt2WFDeW/VnNTXYjJfSkmJCof9yRP b9DPJYQ3cTDi65k66XE6GFNSMgjrr3z4OW85x+4658FCP0KZIQNcRr725PrHfzM7bnWw nMkmF2yHljx4dc8wzahu6KPekFrcuFTE/2hGBLfyZwpFGKwIckVNoivuQu8L01YeJE+g zwPUDYhBdEclXdRpSmLBoUh+9DOV1r7yYzxaHR4wZeC7pt3gQqtvLeZGFA3YSdi2ipDu iB8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PLCQKZfzWqBvZ3fNsIg7ssx6JJEt23zVLXYENI3nPr8=; b=h92j2i4C70xFEQD9VSIcGBPurvBACostuPaqNfwWGcwy1N/Qe0rnFAGW0fWmuKI4Rg ZO1WZMO4/KSNThEAFowq5lK+6+U6++GkTIeqBM2VtKWMqaUOxSaqVoK+/2WNc2OHp44x WPpdBhi7NLaEEtd6oEMhjR3dkG2PQp/5j/gwRDKR+aaR0/lmv28f5+hCzAMKreM33bRF DHfGP6AOEncsL+Nv0B+hJwJerW6kCKDSaoIPK35MLq6zMqwo9DlwbvMm1jrFTFgetcN4 jFIXt0eH4NlpdMN+r1GELl3hIEG72McyTME1WgmEuDif6rppGhXOdQxDUegDa5cJPESI dR1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="NzcW/Tcd"; 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 he7si6540566ejc.676.2020.12.07.08.37.56; Mon, 07 Dec 2020 08:38:20 -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="NzcW/Tcd"; 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 S1727857AbgLGQew (ORCPT + 99 others); Mon, 7 Dec 2020 11:34:52 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:29734 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727800AbgLGQel (ORCPT ); Mon, 7 Dec 2020 11:34:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607358795; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PLCQKZfzWqBvZ3fNsIg7ssx6JJEt23zVLXYENI3nPr8=; b=NzcW/TcdiYV6pe1NgnOv5g6YUXRyR/VrkxlnoTfJC6Znr2SP2NwJkexB6GkfXWON7a7P3Z TTFpRPJa9xv96xSiNSiNQIm1vQULhhl2R27lICZ+HD74AvwwL4+NSAZybNyGbbIfZC1u6r dgodPu8m0X3hvGSRx+zlsN6Oexn8/xc= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-296-Qa8E_xTsP6SqmefuKuo1EQ-1; Mon, 07 Dec 2020 11:33:13 -0500 X-MC-Unique: Qa8E_xTsP6SqmefuKuo1EQ-1 Received: by mail-ej1-f71.google.com with SMTP id m4so998812ejc.14 for ; Mon, 07 Dec 2020 08:33:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PLCQKZfzWqBvZ3fNsIg7ssx6JJEt23zVLXYENI3nPr8=; b=ocS+chuRwP8gnMPi9p+Onhu2eAOnT6WIxduGbqrC3BpK0EVVEeKGU3uJSPubLlg4Ux v9yRcI1BlZ7OE+kflzEKeBCzfAs/+cpnKZa6uhxpRd9M3oYtc6Heh1begArmGHDhQygn jce9BIQfLuxDjmSkGZpeqJLBmwzjPNKaW+leYtSJfiiSS8SnmaGPM9QLahdMpOLpgMNk 930Yh2OsKf7PXRXvxt+HMuDaGjhxzs0v5DB4uP+SlrV0CbuI/Wu8vHnwMqnOuCO85y6m LH5UT81kWwNYqadd2hLQ6+IbMkfGx10RXyCY3LdN4tsaWMQ4CK8ThM4MhTrTsNj1b9u/ cu2A== X-Gm-Message-State: AOAM532K0rY6Pb4NUcJcRScc3PJz4ZLPPuGqbdTv+YeaSN0PRWttgLPI rS7ilIzp6l2wfXHt5ST1V3wDh+GX082nlpVkpOB2XUZRnB+7RWJPYobZiDbFaWBu/EEqCP0mjZZ H5MMYEn5s6qbHOSF3udNqgu6O X-Received: by 2002:a50:9f4a:: with SMTP id b68mr20511324edf.296.1607358792115; Mon, 07 Dec 2020 08:33:12 -0800 (PST) X-Received: by 2002:a50:9f4a:: with SMTP id b68mr20511314edf.296.1607358791932; Mon, 07 Dec 2020 08:33:11 -0800 (PST) Received: from miu.piliscsaba.redhat.com (catv-86-101-169-67.catv.broadband.hu. [86.101.169.67]) by smtp.gmail.com with ESMTPSA id op5sm12801964ejb.43.2020.12.07.08.33.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Dec 2020 08:33:11 -0800 (PST) From: Miklos Szeredi To: "Eric W . Biederman" Cc: linux-fsdevel@vger.kernel.org, linux-unionfs@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 09/10] ovl: do not get metacopy for userxattr Date: Mon, 7 Dec 2020 17:32:54 +0100 Message-Id: <20201207163255.564116-10-mszeredi@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201207163255.564116-1-mszeredi@redhat.com> References: <20201207163255.564116-1-mszeredi@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When looking up an inode on the lower layer for which the mounter lacks read permisison the metacopy check will fail. This causes the lookup to fail as well, even though the directory is readable. So ignore EACCES for the "userxattr" case and assume no metacopy for the unreadable file. Signed-off-by: Miklos Szeredi --- fs/overlayfs/util.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c index 66eaf4db027f..703c6e529f39 100644 --- a/fs/overlayfs/util.c +++ b/fs/overlayfs/util.c @@ -880,6 +880,13 @@ int ovl_check_metacopy_xattr(struct ovl_fs *ofs, struct dentry *dentry) if (res < 0) { if (res == -ENODATA || res == -EOPNOTSUPP) return 0; + /* + * getxattr on user.* may fail with EACCES in case there's no + * read permission on the inode. Not much we can do, other than + * tell the caller that this is not a metacopy inode. + */ + if (ofs->config.userxattr && res == -EACCES) + return 0; goto out; } -- 2.26.2