From 2ed485806a2979fb0f4b54d121aba1a93863cf82 Mon Sep 17 00:00:00 2001 From: mpi Date: Mon, 8 Jan 2018 22:33:13 +0000 Subject: [PATCH] Do not pass a userland pointer to ktrabstimespec(). Prevents an infinite pagefault/pmap_enter() loop when ktracing apps doing a lot of futex(2) calls like firefox & chrome. --- sys/kern/sys_futex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/kern/sys_futex.c b/sys/kern/sys_futex.c index 9d00d0f46d9..a31dfdd41a5 100644 --- a/sys/kern/sys_futex.c +++ b/sys/kern/sys_futex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_futex.c,v 1.5 2017/12/19 16:41:43 deraadt Exp $ */ +/* $OpenBSD: sys_futex.c,v 1.6 2018/01/08 22:33:13 mpi Exp $ */ /* * Copyright (c) 2016-2017 Martin Pieuchot @@ -212,7 +212,7 @@ futex_wait(uint32_t *uaddr, uint32_t val, const struct timespec *timeout) return error; #ifdef KTRACE if (KTRPOINT(p, KTR_STRUCT)) - ktrabstimespec(p, timeout); + ktrabstimespec(p, &ts); #endif to_ticks = (uint64_t)hz * ts.tv_sec + (ts.tv_nsec + tick * 1000 - 1) / (tick * 1000) + 1; -- 2.20.1