From d25ca13ed8acdf609329055ef9c36d0f3fae9503 Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Tue, 27 Aug 2019 04:04:46 +0200 Subject: kernel: make user stack segment non-executable --- sys/src/9/port/sysproc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sys/src/9/port/sysproc.c') diff --git a/sys/src/9/port/sysproc.c b/sys/src/9/port/sysproc.c index 56dc793d6..259b2d891 100644 --- a/sys/src/9/port/sysproc.c +++ b/sys/src/9/port/sysproc.c @@ -429,7 +429,7 @@ sysexec(va_list list) 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 -- cgit v1.2.3