ANDROID: GKI: set vfs-only exports into their own namespace

We have namespaces, so use them for all vfs-exported namespaces so that
filesystems can use them, but not anything else.

Bug: 157965270
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ic214d31360af5f1e025a176a61e346a8ec62a735
This commit is contained in:
Greg Kroah-Hartman 2020-07-02 12:51:03 +02:00
parent dd17237d72
commit 7bc3e32f7f
7 changed files with 18 additions and 15 deletions

View File

@ -6,6 +6,8 @@
# Rewritten to use lists instead of if-statements. # Rewritten to use lists instead of if-statements.
# #
ccflags-y += -DANDROID_GKI_VFS_EXPORT_ONLY=VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver
obj-y := open.o read_write.o file_table.o super.o \ obj-y := open.o read_write.o file_table.o super.o \
char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \ char_dev.o stat.o exec.o pipe.o namei.o fcntl.o \
ioctl.o readdir.o select.o dcache.o inode.o \ ioctl.o readdir.o select.o dcache.o inode.o \

View File

@ -101,3 +101,4 @@ module_exit(cleanup_incfs_module);
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
MODULE_AUTHOR("Eugene Zemtsov <ezemtsov@google.com>"); MODULE_AUTHOR("Eugene Zemtsov <ezemtsov@google.com>");
MODULE_DESCRIPTION("Incremental File System"); MODULE_DESCRIPTION("Incremental File System");
MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver);

View File

@ -2509,7 +2509,7 @@ int kern_path(const char *name, unsigned int flags, struct path *path)
return filename_lookup(AT_FDCWD, getname_kernel(name), return filename_lookup(AT_FDCWD, getname_kernel(name),
flags, path, NULL); flags, path, NULL);
} }
EXPORT_SYMBOL(kern_path); EXPORT_SYMBOL_NS(kern_path, ANDROID_GKI_VFS_EXPORT_ONLY);
/** /**
* vfs_path_lookup - lookup a file path relative to a dentry-vfsmount pair * vfs_path_lookup - lookup a file path relative to a dentry-vfsmount pair
@ -2989,7 +2989,7 @@ int vfs_create(struct inode *dir, struct dentry *dentry, umode_t mode,
fsnotify_create(dir, dentry); fsnotify_create(dir, dentry);
return error; return error;
} }
EXPORT_SYMBOL(vfs_create); EXPORT_SYMBOL_NS(vfs_create, ANDROID_GKI_VFS_EXPORT_ONLY);
int vfs_mkobj(struct dentry *dentry, umode_t mode, int vfs_mkobj(struct dentry *dentry, umode_t mode,
int (*f)(struct dentry *, umode_t, void *), int (*f)(struct dentry *, umode_t, void *),
@ -3896,7 +3896,7 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
fsnotify_mkdir(dir, dentry); fsnotify_mkdir(dir, dentry);
return error; return error;
} }
EXPORT_SYMBOL(vfs_mkdir); EXPORT_SYMBOL_NS(vfs_mkdir, ANDROID_GKI_VFS_EXPORT_ONLY);
long do_mkdirat(int dfd, const char __user *pathname, umode_t mode) long do_mkdirat(int dfd, const char __user *pathname, umode_t mode)
{ {
@ -3971,7 +3971,7 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry)
d_delete(dentry); d_delete(dentry);
return error; return error;
} }
EXPORT_SYMBOL(vfs_rmdir); EXPORT_SYMBOL_NS(vfs_rmdir, ANDROID_GKI_VFS_EXPORT_ONLY);
long do_rmdir(int dfd, const char __user *pathname) long do_rmdir(int dfd, const char __user *pathname)
{ {
@ -4094,7 +4094,7 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry, struct inode **delegate
return error; return error;
} }
EXPORT_SYMBOL(vfs_unlink); EXPORT_SYMBOL_NS(vfs_unlink, ANDROID_GKI_VFS_EXPORT_ONLY);
/* /*
* Make sure that the actual truncation of the file will occur outside its * Make sure that the actual truncation of the file will occur outside its
@ -4330,7 +4330,7 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de
fsnotify_link(dir, inode, new_dentry); fsnotify_link(dir, inode, new_dentry);
return error; return error;
} }
EXPORT_SYMBOL(vfs_link); EXPORT_SYMBOL_NS(vfs_link, ANDROID_GKI_VFS_EXPORT_ONLY);
/* /*
* Hardlinks are often used in delicate situations. We avoid * Hardlinks are often used in delicate situations. We avoid
@ -4590,7 +4590,7 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
return error; return error;
} }
EXPORT_SYMBOL(vfs_rename); EXPORT_SYMBOL_NS(vfs_rename, ANDROID_GKI_VFS_EXPORT_ONLY);
static int do_renameat2(int olddfd, const char __user *oldname, int newdfd, static int do_renameat2(int olddfd, const char __user *oldname, int newdfd,
const char __user *newname, unsigned int flags) const char __user *newname, unsigned int flags)

View File

@ -321,7 +321,7 @@ int vfs_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
file_end_write(file); file_end_write(file);
return ret; return ret;
} }
EXPORT_SYMBOL_GPL(vfs_fallocate); EXPORT_SYMBOL_NS_GPL(vfs_fallocate, ANDROID_GKI_VFS_EXPORT_ONLY);
int ksys_fallocate(int fd, int mode, loff_t offset, loff_t len) int ksys_fallocate(int fd, int mode, loff_t offset, loff_t len)
{ {
@ -932,7 +932,7 @@ struct file *dentry_open(const struct path *path, int flags,
} }
return f; return f;
} }
EXPORT_SYMBOL(dentry_open); EXPORT_SYMBOL_NS(dentry_open, ANDROID_GKI_VFS_EXPORT_ONLY);
struct file *open_with_fake_path(const struct path *path, int flags, struct file *open_with_fake_path(const struct path *path, int flags,
struct inode *inode, const struct cred *cred) struct inode *inode, const struct cred *cred)

View File

@ -441,7 +441,7 @@ ssize_t kernel_read(struct file *file, void *buf, size_t count, loff_t *pos)
set_fs(old_fs); set_fs(old_fs);
return result; return result;
} }
EXPORT_SYMBOL(kernel_read); EXPORT_SYMBOL_NS(kernel_read, ANDROID_GKI_VFS_EXPORT_ONLY);
ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos) ssize_t vfs_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
{ {
@ -537,7 +537,7 @@ ssize_t kernel_write(struct file *file, const void *buf, size_t count,
return res; return res;
} }
EXPORT_SYMBOL(kernel_write); EXPORT_SYMBOL_NS(kernel_write, ANDROID_GKI_VFS_EXPORT_ONLY);
ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_t *pos) ssize_t vfs_write(struct file *file, const char __user *buf, size_t count, loff_t *pos)
{ {

View File

@ -117,7 +117,7 @@ int vfs_getattr(const struct path *path, struct kstat *stat,
return retval; return retval;
return vfs_getattr_nosec(path, stat, request_mask, query_flags); return vfs_getattr_nosec(path, stat, request_mask, query_flags);
} }
EXPORT_SYMBOL(vfs_getattr); EXPORT_SYMBOL_NS(vfs_getattr, ANDROID_GKI_VFS_EXPORT_ONLY);
/** /**
* vfs_statx_fd - Get the enhanced basic attributes by file descriptor * vfs_statx_fd - Get the enhanced basic attributes by file descriptor

View File

@ -227,7 +227,7 @@ vfs_setxattr(struct dentry *dentry, const char *name, const void *value,
inode_unlock(inode); inode_unlock(inode);
return error; return error;
} }
EXPORT_SYMBOL_GPL(vfs_setxattr); EXPORT_SYMBOL_NS_GPL(vfs_setxattr, ANDROID_GKI_VFS_EXPORT_ONLY);
static ssize_t static ssize_t
xattr_getsecurity(struct inode *inode, const char *name, void *value, xattr_getsecurity(struct inode *inode, const char *name, void *value,
@ -341,7 +341,7 @@ vfs_getxattr(struct dentry *dentry, const char *name, void *value, size_t size)
{ {
return __vfs_getxattr(dentry, dentry->d_inode, name, value, size, 0); return __vfs_getxattr(dentry, dentry->d_inode, name, value, size, 0);
} }
EXPORT_SYMBOL_GPL(vfs_getxattr); EXPORT_SYMBOL_NS_GPL(vfs_getxattr, ANDROID_GKI_VFS_EXPORT_ONLY);
ssize_t ssize_t
vfs_listxattr(struct dentry *dentry, char *list, size_t size) vfs_listxattr(struct dentry *dentry, char *list, size_t size)
@ -361,7 +361,7 @@ vfs_listxattr(struct dentry *dentry, char *list, size_t size)
} }
return error; return error;
} }
EXPORT_SYMBOL_GPL(vfs_listxattr); EXPORT_SYMBOL_NS_GPL(vfs_listxattr, ANDROID_GKI_VFS_EXPORT_ONLY);
int int
__vfs_removexattr(struct dentry *dentry, const char *name) __vfs_removexattr(struct dentry *dentry, const char *name)