ref: d25ca13ed8acdf609329055ef9c36d0f3fae9503
parent: 1e773c97e79d74983edd9b46694956f76b0c7fd5
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