ref: 066865bb4070feeaabfa5ad1a096ac3075476033
parent: 8354d5d8690d8ec7bcd517cee87fdfe336afc9e1
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Sep 8 15:02:01 EDT 2019
kernel: clear FPillegal in pexit() and before pprint() pexit() and pprint() can get called outside of a syscall (from procctl()) with a process that is in active note handling and require floating point in the kernel on amd64 for aesni (devtls).
--- a/sys/src/9/pc64/trap.c
+++ b/sys/src/9/pc64/trap.c
@@ -877,8 +877,10 @@
if(n->flag!=NUser && (up->notified || up->notify==0)){qunlock(&up->debug);
- if(n->flag == NDebug)
+ if(n->flag == NDebug){+ up->fpstate &= ~FPillegal;
pprint("suicide: %s\n", n->msg);+ }
pexit(n->msg, n->flag!=NDebug);
}
@@ -901,6 +903,7 @@
if(!okaddr((uintptr)up->notify, 1, 0)
|| !okaddr(sp-ERRMAX-4*BY2WD, sizeof(Ureg)+ERRMAX+4*BY2WD, 1)){qunlock(&up->debug);
+ up->fpstate &= ~FPillegal;
pprint("suicide: bad address in notify\n"); pexit("Suicide", 0);}
--- a/sys/src/9/port/proc.c
+++ b/sys/src/9/port/proc.c
@@ -1094,6 +1094,7 @@
Chan *dot;
void (*pt)(Proc*, int, vlong);
+ up->fpstate &= ~FPillegal;
up->alarm = 0;
timerdel(up);
pt = proctrace;
@@ -1466,6 +1467,7 @@
switch(up->procctl) {case Proc_exitbig:
spllo();
+ up->fpstate &= ~FPillegal;
pprint("Killed: Insufficient physical memory\n"); pexit("Killed: Insufficient physical memory", 1);--
⑨