summaryrefslogtreecommitdiff
path: root/sys/src/9/bcm
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2019-08-27 03:47:18 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2019-08-27 03:47:18 +0200
commit2149600d129944f60cbc858bc669193af0523409 (patch)
tree89cd2d2b36e204bbb50ed2159ebdbf7f2cd7e01c /sys/src/9/bcm
parent128ea44a89c7905612ad2fa5a61a9325ddfb5e1e (diff)
kernel: catch execution read fault on SG_NOEXEC segment
fault() now has an additional pc argument that is used to detect fault on a non-executable segment. that is, we check on read fault if the segment has the SG_NOEXEC attribute and the program counter is within faulting page.
Diffstat (limited to 'sys/src/9/bcm')
-rw-r--r--sys/src/9/bcm/trap.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/sys/src/9/bcm/trap.c b/sys/src/9/bcm/trap.c
index 8522eacd2..5affb4070 100644
--- a/sys/src/9/bcm/trap.c
+++ b/sys/src/9/bcm/trap.c
@@ -87,8 +87,6 @@ faultarm(Ureg *ureg, uintptr va, int user, int read)
{
int n, insyscall;
char buf[ERRMAX];
- static int cnt, lastpid;
- static ulong lastva;
if(up == nil) {
dumpregs(ureg);
@@ -96,20 +94,7 @@ faultarm(Ureg *ureg, uintptr va, int user, int read)
}
insyscall = up->insyscall;
up->insyscall = 1;
- /* this is quite helpful during mmu and cache debugging */
- if(va == lastva && up->pid == lastpid) {
- ++cnt;
- if (cnt >= 2)
- /* fault() isn't fixing the underlying cause */
- panic("fault: %d consecutive faults for va %#lux",
- cnt+1, va);
- } else {
- cnt = 0;
- lastva = va;
- lastpid = up->pid;
- }
-
- n = fault(va, read);
+ n = fault(va, ureg->pc, read);
if(n < 0){
if(!user){
dumpregs(ureg);