From: Eric W. Biederman Date: Sat, 26 Jan 2013 00:32:10 +0000 (-0800) Subject: userns: Allow the userns root to mount tmpfs. X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=2b8576cb09a7b1b581c253554bf9e05d3adce7d6;p=linux-beck.git userns: Allow the userns root to mount tmpfs. There is no backing store to tmpfs and file creation rules are the same as for any other filesystem so it is semantically safe to allow unprivileged users to mount it. ramfs is safe for the same reasons so allow either flavor of tmpfs to be mounted by a user namespace root user. The memory control group successfully limits how much memory tmpfs can consume on any system that cares about a user namespace root using tmpfs to exhaust memory the memory control group can be deployed. Signed-off-by: "Eric W. Biederman" --- diff --git a/mm/shmem.c b/mm/shmem.c index 5c90d84c2b02..197ca5eccbae 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2766,6 +2766,7 @@ static struct file_system_type shmem_fs_type = { .name = "tmpfs", .mount = shmem_mount, .kill_sb = kill_litter_super, + .fs_flags = FS_USERNS_MOUNT, }; int __init shmem_init(void) @@ -2823,6 +2824,7 @@ static struct file_system_type shmem_fs_type = { .name = "tmpfs", .mount = ramfs_mount, .kill_sb = kill_litter_super, + .fs_flags = FS_USERNS_MOUNT, }; int __init shmem_init(void)