[PATCH] D57924: [safestack] Remove pageSize
Vitaly Buka via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 7 15:22:55 PST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL353481: [safestack] Remove pageSize (authored by vitalybuka, committed by ).
Herald added a subscriber: delcypher.
Changed prior to commit:
https://reviews.llvm.org/D57924?vs=185874&id=185879#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57924/new/
https://reviews.llvm.org/D57924
Files:
compiler-rt/trunk/lib/safestack/safestack.cc
Index: compiler-rt/trunk/lib/safestack/safestack.cc
===================================================================
--- compiler-rt/trunk/lib/safestack/safestack.cc
+++ compiler-rt/trunk/lib/safestack/safestack.cc
@@ -82,9 +82,6 @@
/// size rlimit is set to infinity.
const unsigned kDefaultUnsafeStackSize = 0x2800000;
-/// Runtime page size obtained through sysconf
-unsigned pageSize;
-
// Per-thread unsafe stack information. It's not frequently accessed, so there
// it can be kept out of the tcb in normal thread-local variables.
__thread void *unsafe_stack_start = nullptr;
@@ -93,8 +90,8 @@
inline void *unsafe_stack_alloc(size_t size, size_t guard) {
SFS_CHECK(size + guard >= size);
- void *addr = Mmap(nullptr, RoundUpTo(size + guard, pageSize),
- PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
+ void *addr = Mmap(nullptr, size + guard, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANON, -1, 0);
SFS_CHECK(MAP_FAILED != addr);
Mprotect(addr, guard, PROT_NONE);
return (char *)addr + guard;
@@ -229,7 +226,6 @@
SFS_CHECK(size);
size = RoundUpTo(size, kStackAlign);
- SFS_CHECK((guard & (pageSize - 1)) == 0);
void *addr = unsafe_stack_alloc(size, guard);
struct tinfo *tinfo =
@@ -265,8 +261,6 @@
__attribute__((constructor(0)))
#endif
void __safestack_init() {
- pageSize = sysconf(_SC_PAGESIZE);
-
// Determine the stack size for the main thread.
size_t size = kDefaultUnsafeStackSize;
size_t guard = 4096;
@@ -277,7 +271,6 @@
// Allocate unsafe stack for main thread
void *addr = unsafe_stack_alloc(size, guard);
-
unsafe_stack_setup(addr, size, guard);
// Setup the cleanup handler
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57924.185879.patch
Type: text/x-patch
Size: 1717 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190207/9ef7b3eb/attachment.bin>
More information about the llvm-commits
mailing list