diff options
| author | 2019-01-06 12:59:45 +0000 | |
|---|---|---|
| committer | 2019-01-06 12:59:45 +0000 | |
| commit | ec412da11be49c25266553c64da7e06a018ba909 (patch) | |
| tree | 448321fd2d08343c136e4be46e6c0fcbf75db7c3 /sys/kern/kern_exit.c | |
| parent | Rewrite ip_pcbopts() to fill a fresh mbuf with the ip options instead (diff) | |
| download | wireguard-openbsd-ec412da11be49c25266553c64da7e06a018ba909.tar.xz wireguard-openbsd-ec412da11be49c25266553c64da7e06a018ba909.zip | |
Fix unsafe use of ptsignal() in mi_switch().
ptsignal() has to be called with the kernel lock held. As ensuring the
locking in mi_switch() is not easy, and deferring the signaling using
the task API is not possible because of lock order issues in
mi_switch(), move the CPU time checking into a periodic timer where
the kernel can be locked without issues.
With this change, each process has a dedicated resource check timer.
The timer gets activated only when a CPU time limit is set. Because the
checking is not done as frequently as before, some precision is lost.
Use of timers adapted from FreeBSD.
OK tedu@
Reported-by: syzbot+2f5d62256e3280634623@syzkaller.appspotmail.com
Diffstat (limited to 'sys/kern/kern_exit.c')
| -rw-r--r-- | sys/kern/kern_exit.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/kern_exit.c b/sys/kern/kern_exit.c index b190eb6a7ac..7d38cc93870 100644 --- a/sys/kern/kern_exit.c +++ b/sys/kern/kern_exit.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_exit.c,v 1.171 2018/11/12 15:09:17 visa Exp $ */ +/* $OpenBSD: kern_exit.c,v 1.172 2019/01/06 12:59:45 visa Exp $ */ /* $NetBSD: kern_exit.c,v 1.39 1996/04/22 01:38:25 christos Exp $ */ /* @@ -192,6 +192,7 @@ exit1(struct proc *p, int rv, int flags) fdfree(p); timeout_del(&pr->ps_realit_to); + timeout_del(&pr->ps_rucheck_to); #ifdef SYSVSEM semexit(pr); #endif |
