Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp7318421imm; Tue, 28 Aug 2018 09:54:27 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYiJcHVm9xd2FU0Y2CGSjveu7AVCVFl49yw52cMB1B2gH9kU7RPyavSWbt7PCVNjNXjvLXj X-Received: by 2002:a62:ba0b:: with SMTP id k11-v6mr2413815pff.171.1535475267694; Tue, 28 Aug 2018 09:54:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535475267; cv=none; d=google.com; s=arc-20160816; b=DuFBIdt2b5lTMWkYObqh3302Pq+EBh0RPbBjaDv2cLV+4pcfn+XJN8+1aFlIiWDW1P t1ouAWpZd9aerazfBBdtL6HHKUqlhyUd+vBtrB2PMyckYiChvj7bwDox8mfutL3FDLsU ED0DXI0cSwDNKA5L+WPxZ6UPue3ZhX91mCPXJHK7tFw5KD37UrHkAys0jt1X09QmObiu v21KFB6WM592vRTsj8JZVUonbdIAU8OsgkEQj8CrVXCfjU03bWtMsuqxcwNHILqzdQPE XiErRWVjxxCHs4t8/uomSQvE7gbv8akKcSvxSGvm8MkLni9aDahWGOKNUqJOASFQJvcD M+FQ== 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 :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=3pxqf2xwjHgD16uqeoXosgcQyjTIF63IqatPxzwu/s4=; b=KmZ1MiIYe5iD1tmNHFdS0uHPIgBJ+iJeq4rpfluoMdk4YU1sVX501WME/jKQ1GfQXY 5aWeRUUTIkXhOuEpJ3FUsK6A+q4qYbaatitjOLrWvxDaefn8jl8J3YqTeQ5BBjt7KkVr wEkENdZZalQRvGdeXBYfJ+zgz+KB6B7RIiuvBopoWkydu/jrDL9+UHUFLh0INntQkn5B T0cSQseQt2eJShnFVZYZsvJ7B0+U0c/euT2PHCEjxrnOO/eDeF3r0Bwn+i6bRMdh/zz3 OuzxYF5PSVAWlFDIzUutrR613CvX44Qrd0NiqFlLfLhUBDuJYrDNhAvKmPhlSttZbuKG b7kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=RsySshW5; 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=android.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k7-v6si1320817plt.327.2018.08.28.09.54.12; Tue, 28 Aug 2018 09:54:27 -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=@android.com header.s=20161025 header.b=RsySshW5; 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=android.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727388AbeH1UpP (ORCPT + 99 others); Tue, 28 Aug 2018 16:45:15 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:39992 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727356AbeH1UpO (ORCPT ); Tue, 28 Aug 2018 16:45:14 -0400 Received: by mail-pl1-f195.google.com with SMTP id s17-v6so977052plp.7 for ; Tue, 28 Aug 2018 09:52:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=3pxqf2xwjHgD16uqeoXosgcQyjTIF63IqatPxzwu/s4=; b=RsySshW5kESw78paO3F5LZqMqPrsD2+mratWqnIRhAD8GGdBpOxXzYb7F0df6pCvhY bl2lWwggD9rLkDhpqg4UYrsNKa635oPhjV5qgMZSv5UUT6DlJDHiGemlwO39BYvufFfY ZQl1F3ZmwcDKdRORp3dHd9btMPEnXNqm+i98hoPM12eI7mGkCpHeL8jSIfvsqag+oBS8 iRIZ8QaxokNtrSBMtlKUsQg5xIvJMJ1xTsvHp/96k6Mi+Sl5nx+Gp2ES8BbNgmYE54G/ xH/nsCaGG1kIOiw9AkSKNJlkwXS6CFbOYviChBkmU7TRooaphNXsRbJed1dhZ5PmXmws yKCQ== 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:mime-version :content-transfer-encoding; bh=3pxqf2xwjHgD16uqeoXosgcQyjTIF63IqatPxzwu/s4=; b=E2iaM6SkOevityjUKwhXyITemUH9LhxrAmTs2F2d17VQ5Bbt4ITzFZdXO2jWX1s7MQ j0K4xDwX7nZTaPsq9GEcvZ5gxFtX6B1jBHjtP6WYx69F8LfzDYcT265TBPVmwRjk4Dbn 5geCoHKWE7jmGDcsG24TBUxOtKP4L/xTZcnD0503B00rcbxtjxf6xEJ5eZ1OulS4gnU3 HhSwGlfvda4XStX/MI5FnS2PwdYX3i4ZDZ0cQyHe8DXlfF6RovVbA+RvQUnu1NpmNJeH Gr3KHXNCubIDfeBHx7zHmDyc97CE46p5aUee0woJrEHYXJItZ3QNXQrjA0OlOk7YsN3z nxKw== X-Gm-Message-State: APzg51Anp/MLjVMhDxxyAO3lNWDisLNBO7/7PU1XZbjimEMp5wuo32xY tua5b9NlZX+REakl43SP9FinF17fn10toQ== X-Received: by 2002:a17:902:9f86:: with SMTP id g6-v6mr2371839plq.304.1535475163146; Tue, 28 Aug 2018 09:52:43 -0700 (PDT) Received: from nebulus.mtv.corp.google.com ([2620:0:1000:1612:b4fb:6752:f21f:3502]) by smtp.gmail.com with ESMTPSA id c78-v6sm2576090pfc.188.2018.08.28.09.52.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Aug 2018 09:52:42 -0700 (PDT) From: Mark Salyzyn To: linux-kernel@vger.kernel.org Cc: Mark Salyzyn , Miklos Szeredi , Jonathan Corbet , Vivek Goyal , "Eric W . Biederman" , Amir Goldstein , Randy Dunlap , Stephen Smalley , linux-unionfs@vger.kernel.org, linux-doc@vger.kernel.org Subject: [PATCH v5 0/3] Date: Tue, 28 Aug 2018 09:52:12 -0700 Message-Id: <20180828165228.211332-1-salyzyn@android.com> X-Mailer: git-send-email 2.19.0.rc0.228.g281dcd1b4d0-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org overlayfs: check CAP_DAC_READ_SEARCH before issuing exportfs_decode_fh overlayfs: check CAP_MKNOD before issuing vfs_whiteout Assumption never checked, should fail if the mounter creds are not sufficient. overlayfs: override_creds=off option bypass creator_cred By default, all access to the upper, lower and work directories is the recorded mounter's MAC and DAC credentials. The incoming accesses are checked against the caller's credentials. If the principles of least privilege are applied, the mounter's credentials might not overlap the credentials of the caller's when accessing the overlayfs filesystem. For example, a file that a lower DAC privileged caller can execute, is MAC denied to the generally higher DAC privileged mounter, to prevent an attack vector. We add the option to turn off override_creds in the mount options; all subsequent operations after mount on the filesystem will be only the caller's credentials. This option default is set in the CONFIG OVERLAY_FS_OVERRIDE_CREDS or in the module option override_creds. The module boolean parameter and mount option override_creds is also added as a presence check for this "feature" by checking existence of /sys/module/overlay/parameters/overlay_creds. This will allow user space to determine if the option can be supplied successfully to the mount(2) operation. Signed-off-by: Mark Salyzyn Cc: Miklos Szeredi Cc: Jonathan Corbet Cc: Vivek Goyal Cc: Eric W. Biederman Cc: Amir Goldstein Cc: Randy Dunlap Cc: Stephen Smalley Cc: linux-unionfs@vger.kernel.org Cc: linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org v2: - Forward port changed attr to stat, resulting in a build error. - altered commit message. v3: - Change name from caller_credentials / creator_credentials to the boolean override_creds. - Changed from creator to mounter credentials. - Updated and fortified the documentation. - Added CONFIG_OVERLAY_FS_OVERRIDE_CREDS v4: - spelling and grammar errors in text v5: - beefed up the caveats in the Documentation - Is dependent on "overlayfs: check CAP_DAC_READ_SEARCH before issuing exportfs_decode_fh" "overlayfs: check CAP_MKNOD before issuing vfs_whiteout" - Added prwarn when override_creds=off