diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c index 4afb04686c8e317ef4f24b41e50fa9d73f7f9722..5743f04014ca8e42b56cd63230b9150949a02ce7 100644 --- a/drivers/base/devtmpfs.c +++ b/drivers/base/devtmpfs.c @@ -387,7 +387,7 @@ static int devtmpfsd(void *p) if (*err) goto out; sys_chdir("/.."); /* will traverse into overmounted root */ - sys_chroot("."); + ksys_chroot("."); complete(&setup_done); while (1) { spin_lock(&req_lock); diff --git a/fs/open.c b/fs/open.c index 7ea118471dce59996ae3d3d9b9e3b9d156baffba..7a475e8a2e41a9c1fba737667b383e4cf00de4be 100644 --- a/fs/open.c +++ b/fs/open.c @@ -479,7 +479,7 @@ SYSCALL_DEFINE1(fchdir, unsigned int, fd) return error; } -SYSCALL_DEFINE1(chroot, const char __user *, filename) +int ksys_chroot(const char __user *filename) { struct path path; int error; @@ -512,6 +512,11 @@ SYSCALL_DEFINE1(chroot, const char __user *, filename) return error; } +SYSCALL_DEFINE1(chroot, const char __user *, filename) +{ + return ksys_chroot(filename); +} + static int chmod_common(const struct path *path, umode_t mode) { struct inode *inode = path->dentry->d_inode; diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index 50876ae1d17ba70353dee11f613b1c99c9fd8b44..920a0db1871d1b8190a7ae3a207eeaf96273692b 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h @@ -950,5 +950,6 @@ int ksys_mount(char __user *dev_name, char __user *dir_name, char __user *type, unsigned long flags, void __user *data); int ksys_umount(char __user *name, int flags); int ksys_dup(unsigned int fildes); +int ksys_chroot(const char __user *filename); #endif diff --git a/init/do_mounts.c b/init/do_mounts.c index eb768de43d847046597d53740167c6a2af6098dc..2f06f7827b0c1e6b11f201f5ad0849b85af41181 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c @@ -600,7 +600,7 @@ void __init prepare_namespace(void) out: devtmpfs_mount("dev"); ksys_mount(".", "/", NULL, MS_MOVE, NULL); - sys_chroot("."); + ksys_chroot("."); } static bool is_tmpfs; diff --git a/init/do_mounts_initrd.c b/init/do_mounts_initrd.c index e8573e1776f6cd0476fdd83fcffa99753107508c..71293265ac4b66e4c4ce1b5ea90eb43dddb3feb0 100644 --- a/init/do_mounts_initrd.c +++ b/init/do_mounts_initrd.c @@ -44,7 +44,7 @@ static int init_linuxrc(struct subprocess_info *info, struct cred *new) /* move initrd over / and chdir/chroot in initrd root */ sys_chdir("/root"); ksys_mount(".", "/", NULL, MS_MOVE, NULL); - sys_chroot("."); + ksys_chroot("."); sys_setsid(); return 0; } @@ -83,7 +83,7 @@ static void __init handle_initrd(void) /* move initrd to rootfs' /old */ ksys_mount("..", ".", NULL, MS_MOVE, NULL); /* switch root and cwd back to / of rootfs */ - sys_chroot(".."); + ksys_chroot(".."); if (new_decode_dev(real_root_dev) == Root_RAM0) { sys_chdir("/old");