Re: [PATCH] unshare: Error if passed unsupported flags

From: Janak Desai
Date: Sat Mar 18 2006 - 10:38:38 EST



Thanks Eric. I had just started to do this based on Andrew's request.

-Janak

Eric W. Biederman wrote:

This patch does a bare bones trivial patch to ensure we always
get -EINVAL on the unsupported cases for sys_unshare. If this
goes in before 2.6.16 it allows us to forward compatible with
future applications using sys_unshare.

Signed-off-by: Eric W. Biederman <ebiederm@xxxxxxxxxxxx>


---

kernel/fork.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)

46868b4b6ebeb9042dded68a6f6301ffe06820c9
diff --git a/kernel/fork.c b/kernel/fork.c
index 46060cb..411b10d 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1535,6 +1535,12 @@ asmlinkage long sys_unshare(unsigned lon
struct sem_undo_list *new_ulist = NULL;

check_unshare_flags(&unshare_flags);
+ + /* Return -EINVAL for all unsupported flags */
+ err = -EINVAL;
+ if (unshare_flags & ~(CLONE_THREAD|CLONE_FS|CLONE_NEWNS|CLONE_SIGHAND|
+ CLONE_VM|CLONE_FILES|CLONE_SYSVSEM))
+ goto bad_unshare_out;

if ((err = unshare_thread(unshare_flags)))
goto bad_unshare_out;



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/