summaryrefslogtreecommitdiffstats
path: root/sys/compat/linux/linux_sched.c
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2012-05-25 04:39:40 +0000
committerguenther <guenther@openbsd.org>2012-05-25 04:39:40 +0000
commita91d5bed59ccf5ef41eaa4f7ed84353bfc50fa4d (patch)
tree8fcb0245dc3ff646e5864cc27ce57437cacf1956 /sys/compat/linux/linux_sched.c
parentImport a number of core functions from libpcap-1.2.0 while preserving (diff)
downloadwireguard-openbsd-a91d5bed59ccf5ef41eaa4f7ed84353bfc50fa4d.tar.xz
wireguard-openbsd-a91d5bed59ccf5ef41eaa4f7ed84353bfc50fa4d.zip
Change the KERN_FILE_BYPID and KERN_FILE_BYUID modes of the KERN_FILE2
sysctl() to be per-process instead of per-thread. This means the filedesc table has to really be per-process instead of per-thread, so make it an error for the linux clone() emulation to try to do otherwise. This removes pointless duplication in fstat's output. requested by jsing@ and deraadt@, ok matthew@ deraadt@
Diffstat (limited to 'sys/compat/linux/linux_sched.c')
-rw-r--r--sys/compat/linux/linux_sched.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_sched.c b/sys/compat/linux/linux_sched.c
index cb35647a43b..599dc9ffc7a 100644
--- a/sys/compat/linux/linux_sched.c
+++ b/sys/compat/linux/linux_sched.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: linux_sched.c,v 1.13 2012/05/24 01:19:16 guenther Exp $ */
+/* $OpenBSD: linux_sched.c,v 1.14 2012/05/25 04:39:40 guenther Exp $ */
/* $NetBSD: linux_sched.c,v 1.6 2000/05/28 05:49:05 thorpej Exp $ */
/*-
@@ -97,9 +97,15 @@ linux_sys_clone(struct proc *p, void *v, register_t *retval)
* CLONE_FS and CLONE_SYSVSEM. Also, we decree it
* to be incompatible with CLONE_VFORK, as I don't
* want to work out whether that's 100% safe.
+ * Requires CLONE_FILES so that the rest of the kernel
+ * can assume that threads share an fd table.
*/
#define REQUIRED \
- (LINUX_CLONE_SIGHAND | LINUX_CLONE_FS | LINUX_CLONE_SYSVSEM)
+ ( LINUX_CLONE_SIGHAND \
+ | LINUX_CLONE_FS \
+ | LINUX_CLONE_SYSVSEM \
+ | LINUX_CLONE_FILES \
+ )
#define BANNED \
LINUX_CLONE_VFORK
if ((cflags & (REQUIRED | BANNED)) != REQUIRED)