Pull namespace update from Christian Brauner: "Add two simple helper macros for the namespace infrastructure" * tag 'namespaces-7.1-rc1.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: nsproxy: Add FOR_EACH_NS_TYPE() X-macro and CLONE_NS_ALL
Showing the changes to kernel (2 of 3 files). Show all
Unified · Split
| @@ -46,6 +46,7 @@ · 45 unmodified lines | |||
| 46 | #include <linux/mm_inline.h> | 46 | #include <linux/mm_inline.h> |
| 47 | #include <linux/memblock.h> | 47 | #include <linux/memblock.h> |
| 48 | #include <linux/nsproxy.h> | 48 | #include <linux/nsproxy.h> |
| 49 | #include <linux/ns/ns_common_types.h> | ||
| 49 | #include <linux/capability.h> | 50 | #include <linux/capability.h> |
| 50 | #include <linux/cpu.h> | 51 | #include <linux/cpu.h> |
| 51 | #include <linux/cgroup.h> | 52 | #include <linux/cgroup.h> |
| @@ -3045,11 +3046,9 @@ void __init proc_caches_init(void) · 2993 unmodified lines | |||
| 3045 | */ | 3046 | */ |
| 3046 | static int check_unshare_flags(unsigned long unshare_flags) | 3047 | static int check_unshare_flags(unsigned long unshare_flags) |
| 3047 | { | 3048 | { |
| 3048 | if (unshare_flags & ~(CLONE_THREAD|CLONE_FS|CLONE_NEWNS|CLONE_SIGHAND| | 3049 | if (unshare_flags & ~(CLONE_THREAD|CLONE_FS|CLONE_SIGHAND| |
| 3049 | CLONE_VM|CLONE_FILES|CLONE_SYSVSEM| | 3050 | CLONE_VM|CLONE_FILES|CLONE_SYSVSEM| |
| 3050 | CLONE_NEWUTS|CLONE_NEWIPC|CLONE_NEWNET| | 3051 | CLONE_NS_ALL)) |
| 3051 | CLONE_NEWUSER|CLONE_NEWPID|CLONE_NEWCGROUP| | ||
| 3052 | CLONE_NEWTIME)) | ||
| 3053 | return -EINVAL; | 3052 | return -EINVAL; |
| 3054 | /* | 3053 | /* |
| 3055 | * Not implemented, but pretend it works if there is nothing | 3054 | * Not implemented, but pretend it works if there is nothing |
| @@ -12,6 +12,7 @@ · 11 unmodified lines | |||
| 12 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
| 13 | #include <linux/export.h> | 13 | #include <linux/export.h> |
| 14 | #include <linux/nsproxy.h> | 14 | #include <linux/nsproxy.h> |
| 15 | #include <linux/ns/ns_common_types.h> | ||
| 15 | #include <linux/init_task.h> | 16 | #include <linux/init_task.h> |
| 16 | #include <linux/mnt_namespace.h> | 17 | #include <linux/mnt_namespace.h> |
| 17 | #include <linux/utsname.h> | 18 | #include <linux/utsname.h> |
| @@ -170,9 +171,7 @@ int copy_namespaces(u64 flags, struct task_struct *tsk) · 152 unmodified lines | |||
| 170 | struct user_namespace *user_ns = task_cred_xxx(tsk, user_ns); | 171 | struct user_namespace *user_ns = task_cred_xxx(tsk, user_ns); |
| 171 | struct nsproxy *new_ns; | 172 | struct nsproxy *new_ns; |
| 172 | 173 | ||
| 173 | if (likely(!(flags & (CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWIPC | | 174 | if (likely(!(flags & (CLONE_NS_ALL & ~CLONE_NEWUSER)))) { |
| 174 | CLONE_NEWPID | CLONE_NEWNET | | ||
| 175 | CLONE_NEWCGROUP | CLONE_NEWTIME)))) { | ||
| 176 | if ((flags & CLONE_VM) || | 175 | if ((flags & CLONE_VM) || |
| 177 | likely(old_ns->time_ns_for_children == old_ns->time_ns)) { | 176 | likely(old_ns->time_ns_for_children == old_ns->time_ns)) { |
| 178 | get_nsproxy(old_ns); | 177 | get_nsproxy(old_ns); |
| @@ -214,9 +213,7 @@ int unshare_nsproxy_namespaces(unsigned long unshare_flags, · 35 unmodified lines | |||
| 214 | struct user_namespace *user_ns; | 213 | struct user_namespace *user_ns; |
| 215 | int err = 0; | 214 | int err = 0; |
| 216 | 215 | ||
| 217 | if (!(unshare_flags & (CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWIPC | | 216 | if (!(unshare_flags & (CLONE_NS_ALL & ~CLONE_NEWUSER))) |
| 218 | CLONE_NEWNET | CLONE_NEWPID | CLONE_NEWCGROUP | | ||
| 219 | CLONE_NEWTIME))) | ||
| 220 | return 0; | 217 | return 0; |
| 221 | 218 | ||
| 222 | user_ns = new_cred ? new_cred->user_ns : current_user_ns(); | 219 | user_ns = new_cred ? new_cred->user_ns : current_user_ns(); |
| @@ -292,9 +289,7 @@ int exec_task_namespaces(void) · 69 unmodified lines | |||
| 292 | 289 | ||
| 293 | static int check_setns_flags(unsigned long flags) | 290 | static int check_setns_flags(unsigned long flags) |
| 294 | { | 291 | { |
| 295 | if (!flags || (flags & ~(CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWIPC | | 292 | if (!flags || (flags & ~CLONE_NS_ALL)) |
| 296 | CLONE_NEWNET | CLONE_NEWTIME | CLONE_NEWUSER | | ||
| 297 | CLONE_NEWPID | CLONE_NEWCGROUP))) | ||
| 298 | return -EINVAL; | 293 | return -EINVAL; |
| 299 | 294 | ||
| 300 | #ifndef CONFIG_USER_NS | 295 | #ifndef CONFIG_USER_NS |