Module Name:    src
Committed By:   thorpej
Date:           Wed Apr 29 01:44:03 UTC 2020

Modified Files:
        src/sys/compat/linux/common: linux_futex.c
        src/sys/compat/linux32/common: linux32_misc.c

Log Message:
Oops, fix a silly mistake in the Linux futex syscall stubs -- we also
copy in the timeout for FUTEX_WAIT_BITSET.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/compat/linux/common/linux_futex.c
cvs rdiff -u -r1.28 -r1.29 src/sys/compat/linux32/common/linux32_misc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/linux/common/linux_futex.c
diff -u src/sys/compat/linux/common/linux_futex.c:1.39 src/sys/compat/linux/common/linux_futex.c:1.40
--- src/sys/compat/linux/common/linux_futex.c:1.39	Sun Apr 26 18:53:33 2020
+++ src/sys/compat/linux/common/linux_futex.c	Wed Apr 29 01:44:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_futex.c,v 1.39 2020/04/26 18:53:33 thorpej Exp $ */
+/*	$NetBSD: linux_futex.c,v 1.40 2020/04/29 01:44:03 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: linux_futex.c,v 1.39 2020/04/26 18:53:33 thorpej Exp $");
+__KERNEL_RCSID(1, "$NetBSD: linux_futex.c,v 1.40 2020/04/29 01:44:03 thorpej Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -66,9 +66,11 @@ linux_sys_futex(struct lwp *l, const str
 
 	/*
 	 * Linux overlays the "timeout" field and the "val2" field.
-	 * "timeout" is only valid for FUTEX_WAIT on Linux.
+	 * "timeout" is only valid for FUTEX_WAIT and FUTEX_WAIT_BITSET
+	 * on Linux.
 	 */
-	if ((SCARG(uap, op) & FUTEX_CMD_MASK) == FUTEX_WAIT &&
+	const int op = (SCARG(uap, op) & FUTEX_CMD_MASK);
+	if ((op == FUTEX_WAIT || op == FUTEX_WAIT_BITSET) &&
 	    SCARG(uap, timeout) != NULL) {
 		if ((error = copyin(SCARG(uap, timeout), 
 		    &lts, sizeof(lts))) != 0) {

Index: src/sys/compat/linux32/common/linux32_misc.c
diff -u src/sys/compat/linux32/common/linux32_misc.c:1.28 src/sys/compat/linux32/common/linux32_misc.c:1.29
--- src/sys/compat/linux32/common/linux32_misc.c:1.28	Sun Apr 26 18:53:33 2020
+++ src/sys/compat/linux32/common/linux32_misc.c	Wed Apr 29 01:44:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_misc.c,v 1.28 2020/04/26 18:53:33 thorpej Exp $	*/
+/*	$NetBSD: linux32_misc.c,v 1.29 2020/04/29 01:44:03 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 1999 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux32_misc.c,v 1.28 2020/04/26 18:53:33 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_misc.c,v 1.29 2020/04/29 01:44:03 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -250,9 +250,11 @@ linux32_sys_futex(struct lwp *l,
 
 	/*
 	 * Linux overlays the "timeout" field and the "val2" field.
-	 * "timeout" is only valid for FUTEX_WAIT on Linux.
+	 * "timeout" is only valid for FUTEX_WAIT and FUTEX_WAIT_BITSET
+	 * on Linux.
 	 */
-	if ((SCARG(uap, op) & FUTEX_CMD_MASK) == FUTEX_WAIT &&
+	const int op = (SCARG(uap, op) & FUTEX_CMD_MASK);
+	if ((op == FUTEX_WAIT || op == FUTEX_WAIT_BITSET) &&
 	    SCARG_P32(uap, timeout) != NULL) {
 		if ((error = copyin(SCARG_P32(uap, timeout),
 		    &lts, sizeof(lts))) != 0) {

Reply via email to