Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp2818ybg; Fri, 25 Oct 2019 15:33:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqwkTB1yyFIWct2vYCKfzD9an5VYoIDArxRcYDL5V1BrnsBhCzxtrVjYSgkSNoSBfXazgvu0 X-Received: by 2002:a17:906:48c6:: with SMTP id d6mr5809598ejt.291.1572042820828; Fri, 25 Oct 2019 15:33:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572042820; cv=none; d=google.com; s=arc-20160816; b=uC+pvosL3k0+bu8ch5RKsz1HrWuoCnUkaD0aZj8w6dSGoMqo0xFqjh2O5THF1fH8BN p8vFdtwmYms/4ZzzK9gx8AmSwzs+E0mxgz1fHtt/jvz6lb58ioQE+MeUURFhgnTdFl6B dkwPr9USkuBGGU81Tlj85Fih/ryxGZ1ut6hG/LxGLCXZao8GJGrQpy6bxP9uz5cXvhHi APP+E+FLez3gBCSOavNcompz2SRRN846HabacN5WOraEpIKGdSdvTwDzqFTJ/AbPvJ+e AeF8FsxPSuyQx9pLo2fzDkX+QS4rRY6UuG6j/5OT8fNImrF3zG+GncJqlzfPnb5DdxOZ RsqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=I33B+0F6drNe2DO1ImWZrj95FAKHCL4hyPcaly3kasA=; b=F2+lksx8OpuXPOA7C7+9knx84wDegJ6+TmeGSmey2bdh2qef+MhAhWNfshGHn8ZQCR EBZvDJYMwyqn5d4aRvIyLUB9TgRQFbVjItBA2jII/S+peX+4dGRkDTgpFD22tcGIrE2d niCKEW8sNa1lfHhN1F/vJzncdcmXG5iywlvRXdkwz77bZtrITOGpyBje6oXEmZc/eiy+ CH4y9KNNhEkNw1KJaQKP0rVLJEaEyY4XNGjYgfi92863MMJ8OH4YG75KZ+0oWapvPT/7 ZxBO7kajdN1oDyV+MSwQT9mRJDj/xlKhEKHglpWw1DSRhZ8vETQjHDH0K3g1Wmudz0U2 5hMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RjHJgVde; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id p38si2271891edc.449.2019.10.25.15.33.17; Fri, 25 Oct 2019 15:33:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=RjHJgVde; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S2439293AbfJYL30 (ORCPT + 99 others); Fri, 25 Oct 2019 07:29:26 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:57657 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2438379AbfJYL3Z (ORCPT ); Fri, 25 Oct 2019 07:29:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572002964; 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=I33B+0F6drNe2DO1ImWZrj95FAKHCL4hyPcaly3kasA=; b=RjHJgVdeoZqBNgfJFU0FQcr/g3cNGFS3xEn95OYh1qd4ToizDJYfKTLE/B2DCqLzNutVKR 74bVg0KLyYikFKblm18BumWhFHM1RBicaT/QGJrVDU0TAldDujIVWU0vW0Xc5YvzZwp4dA ZhIvaRi4yIrCARwH/8Ts0+hozfe3U7g= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-272-ikXUQY0AO_OQCuEfpsu3iw-1; Fri, 25 Oct 2019 07:29:23 -0400 Received: by mail-wr1-f69.google.com with SMTP id k10so914024wrl.22 for ; Fri, 25 Oct 2019 04:29:22 -0700 (PDT) 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=d8l72uHGzG6m6K3/bpmVJ/Qpjsjtmq+Lqod9QQYQlTc=; b=Sq8S+xxlpDczB173X6rj2JWcXqtIxHVC+N1U3cPT6/OeYjiShb/MS9VCB2NBGARkQJ 7sZ7bJAZc+qmoEWYcDXCMJjyqmn05zV6QLSnvQ0OlArjk0wSK+Gsx/UBvl6QFerlGqVo gcekDCwPquZY9BJlF4176eQi0eJs0TetPGz54PIpsoIYmtYc5AuBtDuo0kCpRhurYh7h 68pPJWanKx5EBLiHMhUU7TmTNmQDMq7Kny7CawFv9mJDshV/tIqzcm3OPt+UeklT+ou2 enlH14x/BQbU0H3ronvnttKdUgSRSY2qtdBaTBIg/m1hP4a796E8zljANSfGEB8FzS9d XMjA== X-Gm-Message-State: APjAAAUjKhl4s1XgfEMcOgn/ieOfPYXq4A79oQ2HerckK8Jfh+RdsJty MX11Vuh8MpVi/jvZUf3vM+07xAe9pR+Tx8BaVKStxU4wAourbMs62wIKLX2eKFICmZl63fpLJxt PccoTzXlhHfyoQ4yrZBvq4kp5 X-Received: by 2002:a5d:6b0e:: with SMTP id v14mr2525705wrw.280.1572002961875; Fri, 25 Oct 2019 04:29:21 -0700 (PDT) X-Received: by 2002:a5d:6b0e:: with SMTP id v14mr2525688wrw.280.1572002961667; Fri, 25 Oct 2019 04:29:21 -0700 (PDT) Received: from miu.piliscsaba.redhat.com (185-79-95-246.pool.digikabel.hu. [185.79.95.246]) by smtp.gmail.com with ESMTPSA id l18sm3974080wrn.48.2019.10.25.04.29.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2019 04:29:20 -0700 (PDT) From: Miklos Szeredi To: "Eric W . Biederman" Cc: linux-unionfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH 1/5] ovl: document permission model Date: Fri, 25 Oct 2019 13:29:13 +0200 Message-Id: <20191025112917.22518-2-mszeredi@redhat.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191025112917.22518-1-mszeredi@redhat.com> References: <20191025112917.22518-1-mszeredi@redhat.com> MIME-Version: 1.0 X-MC-Unique: ikXUQY0AO_OQCuEfpsu3iw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add missing piece of documentation regarding how permissions are checked in overlayfs. Signed-off-by: Miklos Szeredi --- Documentation/filesystems/overlayfs.txt | 44 +++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/Documentation/filesystems/overlayfs.txt b/Documentation/filesy= stems/overlayfs.txt index 845d689e0fd7..674fc8b1e420 100644 --- a/Documentation/filesystems/overlayfs.txt +++ b/Documentation/filesystems/overlayfs.txt @@ -246,6 +246,50 @@ overlay filesystem (though an operation on the name of= the file such as rename or unlink will of course be noticed and handled). =20 =20 +Permission model +---------------- + +Permission checking in the overlay filesystem follows these principles: + + 1) permission check SHOULD return the same result before and after copy u= p + + 2) task creating the overlay mount MUST NOT gain additional privileges + + 3) non-mounting task MAY gain additional privileges through the overlay, + compared to direct access on underlying lower or upper filesystems + +This is achieved by performing two permission checks on each access + + a) check if current task is allowed access based on local DAC (owner, + group, mode and posix acl), as well as MAC checks + + b) check if mounting task would be allowed real operation on lower or + upper layer based on underlying filesystem permissions, again includin= g + MAC checks + +Check (a) ensures consistency (1) since owner, group, mode and posix acls +are copied up. On the other hand it can result in server enforced +permissions (used by NFS, for example) being ignored (3). + +Check (b) ensures that no task gains permissions to underlying layers that +the mounting task does not have (2). This also means that it is possible +to create setups where the consistency rule (1) does not hold; normally, +however, the mounting task will have sufficient privileges to perform all +operations. + +Another way to demonstrate this model is drawing parallels between + + mount -t overlay overlay -olowerdir=3D/lower,upperdir=3D/upper,... /merg= ed + +and + + cp -a /lower /upper + mount --bind /upper /merged + +The resulting access permissions should be the same. The difference is in +the time of copy (on-demand vs. up-front). + + Multiple lower layers --------------------- =20 --=20 2.21.0