summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Bennett <brian.bennett@joyent.com>2020-03-23 19:04:27 -0700
committerGitHub <noreply@github.com>2020-03-23 19:04:27 -0700
commit71d3d1fb721d3893ca04b652d1b175ee2f54ed05 (patch)
treeb007cd9027ca8fa6daedd2c2813709c4d59063fb
parent53825b8d5ba4b74a647ddb0c0212c7b336445fbf (diff)
downloadillumos-joyent-71d3d1fb721d3893ca04b652d1b175ee2f54ed05.tar.gz
OS-8141 lx futex called with NULL timeout and FUTEX_WAIT_BITSET|FUTEX_PRIVATE_FLAG set causes panic (#272)
-rw-r--r--usr/src/uts/common/brand/lx/syscall/lx_futex.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/usr/src/uts/common/brand/lx/syscall/lx_futex.c b/usr/src/uts/common/brand/lx/syscall/lx_futex.c
index 3642b006c0..2a804dbcfe 100644
--- a/usr/src/uts/common/brand/lx/syscall/lx_futex.c
+++ b/usr/src/uts/common/brand/lx/syscall/lx_futex.c
@@ -24,7 +24,7 @@
*/
/*
- * Copyright 2019 Joyent, Inc.
+ * Copyright 2020 Joyent, Inc.
*/
#include <sys/types.h>
@@ -408,6 +408,17 @@ futex_wait(memid_t *memid, caddr_t addr,
goto out;
}
+ /*
+ * We can't have hrtime and a timeout of 0. See below about
+ * CLOCK_REALTIME.
+ * On Linux this is is an invalid state anyway, so we'll short cut
+ * this early to avoid a panic from passing a null pointer to ts2hrt().
+ */
+ if (hrtime && timeout == NULL) {
+ err = set_errno(EINVAL);
+ goto out;
+ }
+
futex_hashin(fwp);
err = 0;