utsns: fix !CONFIG_UTS_NS behavior
PATCH 1/1 utsns: fix !CONFIG_UTS_NS behavior
From: "Serge E. Hallyn" <[email protected]>
Subject: [PATCH] utsns: fix !CONFIG_UTS_NS behavior
When CONFIG_UTS_NS=n, clone(CLONE_NEWUTS) quietly refuses. So correctly does not unshare a new uts namespace, but also does not return -EINVAL.
Fix this to return -EINVAL so the caller knows his request was denied.
---
include/linux/utsname.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
bc350994ac67df8f1b917f9979c065d87757eabe
include/linux/utsname.h +2 -0
@@ -70,6 +70,8 @@ static inline int unshare_utsname(unsignstatic inline int copy_utsname (int flags,struct task_struct *tsk) { +if (flags &CLONE_NEWUTS ) +return -EINVAL ;return 0 ; }static inline void put_uts_ns (struct uts_namespace *ns)
Signature · 1 line
1.1.6
Quoted 18 lines · On Fri, 23 Mar 2007 15:00:39 -0500 "Serge E. Hallyn" <[email protected]> wrote:
When
CONFIG_UTS_NS=n,clone(CLONE_NEWUTS)quietly refuses. So correctly does not unshare a new uts namespace, but also does not return-EINVAL.Fix this to return
-EINVALso the caller knows his request was denied.Signed-off-by Serge E. Hallyn <[email protected]>---
include/linux/utsname.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
bc350994ac67df8f1b917f9979c065d87757eabeinclude/linux/utsname.h +0
-0
include/linux/utsname.h static inline int unshare_utsname(unsign · line 77
Quoted 8 lines
include/linux/utsname.h +2
-0@@ -70,6 +70,8 @@ static inline int unshare_utsname(unsignstatic inline int copy_utsname (int flags,struct task_struct *tsk) { +if (flags &CLONE_NEWUTS ) +return -EINVAL ;return 0 ; }static inline void put_uts_ns (struct uts_namespace *ns)
I'm assuming that this is 2.6.21 material.
Please review -mm's merge-sys_clone-sys_unshare-nsproxy-and-namespace.patch
- it probably needs to propagate this fix.
Quoted 31 lines · Andrew Morton
Quoted 18 lines · On Fri, 23 Mar 2007 15:00:39 -0500 "Serge E. Hallyn" <[email protected]> wrote:
When
CONFIG_UTS_NS=n,clone(CLONE_NEWUTS)quietly refuses. So correctly does not unshare a new uts namespace, but also does not return-EINVAL.Fix this to return
-EINVALso the caller knows his request was denied.Signed-off-by Serge E. Hallyn <[email protected]>---
include/linux/utsname.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
bc350994ac67df8f1b917f9979c065d87757eabeinclude/linux/utsname.h +0
-0include/linux/utsname.h static inline int unshare_utsname(unsign · line 77
Quoted 8 lines
include/linux/utsname.h +2
-0@@ -70,6 +70,8 @@ static inline int unshare_utsname(unsignstatic inline int copy_utsname (int flags,struct task_struct *tsk) { +if (flags &CLONE_NEWUTS ) +return -EINVAL ;return 0 ; }static inline void put_uts_ns (struct uts_namespace *ns)I'm assuming that this is 2.6.21 material.
Quoted 2 lines
Please review -mm's merge-sys_clone-sys_unshare-nsproxy-and-namespace.patch
- it probably needs to propagate this fix.
Yes it does. Here's a patch on top of 2.6.21-rc4-mm1. (or do you prefer I integrate it into merge-sys_clone-sys_unshare-nsproxy-and-namespace.patch itself?)
From: "Serge E. Hallyn" <[email protected]>
Subject: [PATCH] utsns [-mm]: fix !CONFIG_UTS_NS behavior
When CONFIG_UTS_NS=n, clone(CLONE_NEWUTS) quietly refuses. So correctly does not unshare a new uts namespace, but also does not return -EINVAL.
Fix this to return -EINVAL so the caller knows his request was denied.
---
arch/s390/boot/image | Bin include/linux/utsname.h | 3 +++ 2 files changed, 3 insertions(+), 0 deletions(-)
8b4ffb8d88f89f118751f05869613ee16d5c463f
arch/s390/boot/image binary +0 -0
include/linux/utsname.h +3 -0
@@ -35,6 +35,7 @@ struct new_utsname {#include <linux/sched.h> #include <linux/kref.h> #include <linux/nsproxy.h> +#include <linux/err.h> #include <asm/atomic.h> struct uts_namespace {
@@ -60,6 +61,8 @@ static inline void put_uts_ns(struct utsstatic inline struct uts_namespace *copy_utsname (int flags,struct uts_namespace *ns) { +if (flags &CLONE_NEWUTS ) +return ERR_PTR (-EINVAL );return ns; }static inline void put_uts_ns (struct uts_namespace *ns)
Signature · 1 line
1.1.6