summaryrefslogtreecommitdiff
path: root/sys/src/9/kw/syscall.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2013-12-29 07:48:19 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2013-12-29 07:48:19 +0100
commit42074003ca31dea9589012fe3e235e4ddec5be1f (patch)
tree853027cfd12f6cad1f310de95927455d71101656 /sys/src/9/kw/syscall.c
parentafc2d547e18381ce2dd0f69f0e88860d49b7e54f (diff)
kernel: dont call pprint() while holding up->debug qlock
pprint() might block or even (maliciously) call into devproc write which will corrupt the qlock chain on attempt to qlock up->debug again.
Diffstat (limited to 'sys/src/9/kw/syscall.c')
-rw-r--r--sys/src/9/kw/syscall.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/sys/src/9/kw/syscall.c b/sys/src/9/kw/syscall.c
index 4853cfd83..7cf9e20c7 100644
--- a/sys/src/9/kw/syscall.c
+++ b/sys/src/9/kw/syscall.c
@@ -80,16 +80,12 @@ noted(Ureg* cur, uintptr arg0)
cur->sp = PTR2UINT(nf);
break;
default:
- pprint("unknown noted arg %#p\n", arg0);
up->lastnote.flag = NDebug;
/*FALLTHROUGH*/
case NDFLT:
- if(up->lastnote.flag == NDebug){
- qunlock(&up->debug);
+ qunlock(&up->debug);
+ if(up->lastnote.flag == NDebug)
pprint("suicide: %s\n", up->lastnote.msg);
- }
- else
- qunlock(&up->debug);
pexit(up->lastnote.msg, up->lastnote.flag != NDebug);
}
}
@@ -127,9 +123,9 @@ notify(Ureg* ureg)
}
if(n->flag != NUser && (up->notified || up->notify == 0)){
+ qunlock(&up->debug);
if(n->flag == NDebug)
pprint("suicide: %s\n", n->msg);
- qunlock(&up->debug);
pexit(n->msg, n->flag != NDebug);
}
@@ -144,8 +140,8 @@ notify(Ureg* ureg)
pexit(n->msg, n->flag != NDebug);
}
if(!okaddr(PTR2UINT(up->notify), 1, 0)){
- pprint("suicide: notify function address %#p\n", up->notify);
qunlock(&up->debug);
+ pprint("suicide: notify function address %#p\n", up->notify);
pexit("Suicide", 0);
}