summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2021-11-17 01:58:06 +0000
committerAmit Pundir <amit.pundir@linaro.org>2022-01-17 13:35:30 +0530
commitde473671f26d63f02986d3b8428f17c902924d75 (patch)
treeb1f6418ce73a7405a2886cb9b926689c66063732
parente23936d11d94d289c02d03b79fa3c70de18f6495 (diff)
FROMLIST: v19: overlayfs: inode_owner_or_capable called during execv
Using old_creds as an indication that we are not overriding the credentials, bypass call to inode_owner_or_capable. This solves a problem with all execv calls being blocked when using the caller's credentials. Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Mark Salyzyn <salyzyn@android.com> Signed-off-by: David Anderson <dvander@google.com> Fixes: 05acefb4872da ("ovl: check permission to open real file") Cc: linux-fsdevel@vger.kernel.org Cc: linux-unionfs@vger.kernel.org Cc: Stephen Smalley <sds@tycho.nsa.gov> Cc: linux-kernel@vger.kernel.org Cc: linux-security-module@vger.kernel.org Cc: kernel-team@android.com Cc: selinux@vger.kernel.org Cc: paulmoore@microsoft.com Cc: Luca.Boccassi@microsoft.com v19 - rebase v18 - rebase v17 - rebase v16 - introduced fix over rebased series
-rw-r--r--fs/overlayfs/file.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c
index 11d8277c94cd..586de55bba79 100644
--- a/fs/overlayfs/file.c
+++ b/fs/overlayfs/file.c
@@ -55,7 +55,8 @@ static struct file *ovl_open_realfile(const struct file *file,
if (err) {
realfile = ERR_PTR(err);
} else {
- if (!inode_owner_or_capable(&init_user_ns, realinode))
+ if (old_cred && !inode_owner_or_capable(&init_user_ns,
+ realinode))
flags &= ~O_NOATIME;
realfile = open_with_fake_path(&file->f_path, flags, realinode,