summaryrefslogtreecommitdiff
path: root/sys/src/9/port/fault.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2017-05-21 16:36:11 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2017-05-21 16:36:11 +0200
commit760e539811001f569fc24d988e72c0b1eef81cd7 (patch)
tree7e4efd18a56a66f5c6d02d88b3f98758ab2498be /sys/src/9/port/fault.c
parent1dc5f9222a0cddf21414f20731d791ffc0416599 (diff)
kernel: avoid panic with segio and SG_FAULT segments
the problem is that segio doesnt check segment attributes and it can't really in case of SG_FAULT which can be inherited from pseg and toggle at any time. so instead of returning -1 from fault into the fault$cputype handler which then panics when fault happend kernel mode, we jump into segio's waserror() block just like in the demand load i/o error case (faulterror()).
Diffstat (limited to 'sys/src/9/port/fault.c')
-rw-r--r--sys/src/9/port/fault.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/src/9/port/fault.c b/sys/src/9/port/fault.c
index da343e079..a5e80336c 100644
--- a/sys/src/9/port/fault.c
+++ b/sys/src/9/port/fault.c
@@ -40,6 +40,8 @@ fault(uintptr addr, int read)
if((attr & SG_FAULT) != 0 || !read && (attr & SG_RONLY) != 0) {
qunlock(s);
up->psstate = sps;
+ if(up->kp && up->nerrlab) /* for segio */
+ error(Eio);
return -1;
}