shithub: 5v

Download patch

ref: 907de081e187e8630a1710d98b2eae84947fe7c2
parent: 390f5e1938e255599ad1d87a83185b6e57e4b0b8
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Sep 9 21:33:29 EDT 2023

chk: remove debug dumps, correct error message

--- a/chk.c
+++ b/chk.c
@@ -53,10 +53,8 @@
 	int i;
 
 	for(i = 0, p = okrange; i < nokrange; i += 2, p += 2)
-{print("check %#llux <= %#x <= %#llux\n", p[0], pc, p[1]);
 		if(p[0] <= pc && pc <= p[1])
 			return 1;
-}
 	return 0;
 }
 
@@ -82,10 +80,10 @@
 	for(; off != end; off++){
 		bits = seg->shadow[off>>2] >> (2*(off&3));
 		if((bits&chk) != chk && !okfunc(P->R[15]-4)){
-			if(chk&MARKALLOC)
+			if((bits&MARKALLOC) == 0)
 				print("%d: access outside alloc: %#x at PC %#x\n",
 					P->pid, seg->start+off, P->R[15] - 4);
-			if(chk&MARKINIT)
+			if((bits&MARKINIT) == 0)
 				print("%d: invalid read: %#x at PC %#x\n", 
 					P->pid, seg->start+off, P->R[15] - 4);
 			rendezvous(&never, nil);