Skip to content

Commit

Permalink
ANDROID: vfs: Add permission2 for filesystems with per mount permissions
Browse files Browse the repository at this point in the history
This allows filesystems to use their mount private data to
influence the permssions they return in permission2. It has
been separated into a new call to avoid disrupting current
permission users.

Bug: 35848445
Bug: 120446149
Change-Id: I9d416e3b8b6eca84ef3e336bd2af89ddd51df6ca
Signed-off-by: Daniel Rosenberg <[email protected]>
[AmitP: Minor refactoring of original patch to align with
        changes from the following upstream commit
        4bfd054 ("fs: fold __inode_permission() into inode_permission()").
        Also introduce vfs_mkobj2(), because do_create()
        moved from using vfs_create() to vfs_mkobj()
        eecec19 ("mqueue: switch to vfs_mkobj(), quit abusing ->d_fsdata")
        do_create() is dropped/cleaned-up upstream so a
        minor refactoring there as well.
        066cc81 ("do_mq_open(): move all work prior to dentry_open() into a helper")]
Signed-off-by: Amit Pundir <[email protected]>
[astrachan: Folded the following changes into this patch:
            f46c9d62dd81 ("ANDROID: fs: Export vfs_rmdir2")
            9992eb8b9a1e ("ANDROID: xattr: Pass EOPNOTSUPP to permission2")]
Signed-off-by: Alistair Strachan <[email protected]>
  • Loading branch information
drosen-google authored and Alistair Strachan committed Dec 5, 2018
1 parent 74cca90 commit e81cea2
Show file tree
Hide file tree
Showing 11 changed files with 168 additions and 72 deletions.
2 changes: 1 addition & 1 deletion fs/attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ int notify_change2(struct vfsmount *mnt, struct dentry * dentry, struct iattr *
return -EPERM;

if (!inode_owner_or_capable(inode)) {
error = inode_permission(inode, MAY_WRITE);
error = inode_permission2(mnt, inode, MAY_WRITE);
if (error)
return error;
}
Expand Down
2 changes: 1 addition & 1 deletion fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1308,7 +1308,7 @@ EXPORT_SYMBOL(flush_old_exec);
void would_dump(struct linux_binprm *bprm, struct file *file)
{
struct inode *inode = file_inode(file);
if (inode_permission(inode, MAY_READ) < 0) {
if (inode_permission2(file->f_path.mnt, inode, MAY_READ) < 0) {
struct user_namespace *old, *user_ns;
bprm->interp_flags |= BINPRM_FLAGS_ENFORCE_NONDUMP;

Expand Down
Loading

0 comments on commit e81cea2

Please sign in to comment.