git: 9front

Download patch

ref: 6884281668e92a2b21f5cfb230de71fa960b8756
parent: 806f1e3113236c4f8c0176f74343b25c17f0e6b1
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Aug 27 00:04:46 EDT 2019

kernel: make user stack segment non-executable

--- a/sys/src/9/port/sysproc.c
+++ b/sys/src/9/port/sysproc.c
@@ -429,7 +429,7 @@
 		if(tstk <= USTKSIZE)
 			error(Enovmem);
 	} while((s = isoverlap(tstk-USTKSIZE, USTKSIZE)) != nil);
-	up->seg[ESEG] = newseg(SG_STACK, tstk-USTKSIZE, USTKSIZE/BY2PG);
+	up->seg[ESEG] = newseg(SG_STACK | SG_NOEXEC, tstk-USTKSIZE, USTKSIZE/BY2PG);
 
 	/*
 	 * Args: pass 2: assemble; the pages will be faulted in
--