Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/linux/common do more strict flag checking in clon...



details:   https://anonhg.NetBSD.org/src/rev/457793c196f1
branches:  trunk
changeset: 569833:457793c196f1
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Wed Sep 08 19:41:24 2004 +0000

description:
do more strict flag checking in clone(2) (matches what Linux does)

diffstat:

 sys/compat/linux/common/linux_sched.c |  15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diffs (36 lines):

diff -r 893eb934f26b -r 457793c196f1 sys/compat/linux/common/linux_sched.c
--- a/sys/compat/linux/common/linux_sched.c     Wed Sep 08 19:09:43 2004 +0000
+++ b/sys/compat/linux/common/linux_sched.c     Wed Sep 08 19:41:24 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_sched.c,v 1.12 2003/01/18 21:21:30 thorpej Exp $ */
+/*     $NetBSD: linux_sched.c,v 1.13 2004/09/08 19:41:24 jdolecek Exp $        */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.12 2003/01/18 21:21:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.13 2004/09/08 19:41:24 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/mount.h>
@@ -78,6 +78,17 @@
        if (SCARG(uap, flags) & (LINUX_CLONE_PID|LINUX_CLONE_PTRACE))
                return (EINVAL);
 
+       /*
+        * Thread group implies shared signals. Shared signals
+        * imply shared VM. This matches what Linux kernel does.
+        */
+       if (SCARG(uap, flags) & LINUX_CLONE_THREAD
+           && (SCARG(uap, flags) & LINUX_CLONE_SIGHAND) == 0)
+               return (EINVAL);
+       if (SCARG(uap, flags) & LINUX_CLONE_SIGHAND
+           && (SCARG(uap, flags) & LINUX_CLONE_VM) == 0)
+               return (EINVAL);
+
        flags = 0;
 
        if (SCARG(uap, flags) & LINUX_CLONE_VM)



Home | Main Index | Thread Index | Old Index