ANDROID: 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.

Bug: 204981027
Link: https://lore.kernel.org/lkml/20201021151903.652827-5-salyzyn@android.com/
Signed-off-by: David Anderson <dvander@google.com>
Signed-off-by: Mark Salyzyn <salyzyn@android.com>
Change-Id: I6b196483f7a3fa431f4f174c6671c2118e0088dd
This commit is contained in:
David Anderson
2021-11-03 22:41:40 -07:00
committed by Treehugger Robot
parent ae23eedb3f
commit ee4200d565

View File

@@ -60,7 +60,8 @@ static struct file *ovl_open_realfile(const struct file *file,
if (err) {
realfile = ERR_PTR(err);
} else {
if (!inode_owner_or_capable(real_mnt_userns, realinode))
if (old_cred && !inode_owner_or_capable(real_mnt_userns,
realinode))
flags &= ~O_NOATIME;
realfile = open_with_fake_path(&file->f_path, flags, realinode,