diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-03-16 02:37:07 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2013-03-16 02:37:07 +0100 |
commit | f37465fd7f768a72628506956473ae69112cf774 (patch) | |
tree | c568568f95d3fad2a10340b03078bde8a759417f /sys/src/9/mtx | |
parent | 1357a44edc6cf27d2107b00ef91b4353dc2cbecf (diff) |
sysexec: fix possible segment overlap with temporary stack
the kernel uses fixed area (TSTKTOP, TSTKSIZ) of the address
space to temporarily map the new stack segment for exec. for
386 and arm, this area was right below the stack segment which
has the problem that the program can map arbitrary segments
there (even readonly).
alpha and ppc dont have this problem as they map the temporary
exec stack *above* the user reachable stack segement and segattach
prevents one from mapping anything above or overlaping the stack.
lots of arch code assumes USTKTOP being the end of userspace
address space and changing this to TSTKTOP would work, but results
in lots of hard to test changes.
instead, we'r going to map the temporary stack programmatically
finding a hole in the address space where to map it. we also lift
the size limitation for arguments and allow arguments to fill
the whole new stack segement.
the TSTKTOP and TSTKSIZ are not used anymore so they where removed.
references:
http://9fans.net/archive/2013/03/203
http://9fans.net/archive/2013/03/202
http://9fans.net/archive/2013/03/197
http://9fans.net/archive/2013/03/195
http://9fans.net/archive/2013/03/181
Diffstat (limited to 'sys/src/9/mtx')
-rw-r--r-- | sys/src/9/mtx/mem.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sys/src/9/mtx/mem.h b/sys/src/9/mtx/mem.h index 05c01ff8a..587df9919 100644 --- a/sys/src/9/mtx/mem.h +++ b/sys/src/9/mtx/mem.h @@ -170,12 +170,10 @@ #define UZERO 0 /* base of user address space */ #define UTZERO (UZERO+BY2PG) /* first address in user text */ -#define USTKTOP (TSTKTOP-TSTKSIZ*BY2PG) /* byte just beyond user stack */ -#define TSTKTOP KZERO /* top of temporary stack */ -#define TSTKSIZ 100 #define KZERO 0x80000000 /* base of kernel address space */ -#define KTZERO (KZERO+0x4000) /* first address in kernel text */ -#define USTKSIZE (4*1024*1024) /* size of user stack */ +#define KTZERO (KZERO+0x4000) /* first address in kernel text */ +#define USTKTOP KZERO /* byte just beyond user stack */ +#define USTKSIZE (4*1024*1024) /* size of user stack */ #define UREGSIZE ((8+32)*4) #define PCIMEM0 0xf0000000 |