Revert "HBSD: Randomize top of per-thread stacks"

This reverts commit b7b19ffccfb139fc731dca94655b3531a50c61ca. The
per-thread stack randomization needs more thought. It's likely that this
implementation is being too aggressive.

Signed-off-by:	Shawn Webb <shawn.webb@hardenedbsd.org>
(cherry picked from commit 5d741f44acf944a48dd14390fec663b42f962e96)
(cherry picked from commit 233c617c4908a4249a70af89dcbea31575f0dc87)
This commit is contained in:
Shawn Webb 2017-06-25 22:54:56 -04:00 committed by Shawn Webb
parent ff0cec6dcb
commit d0bfc2b738
No known key found for this signature in database
GPG key ID: 411DCD7D5C3BFCB6
2 changed files with 1 additions and 26 deletions

View file

@ -439,7 +439,6 @@ init_private(void)
size_t len;
int mib[2];
char *env, *env_bigstack, *env_splitstack;
unsigned int npages;
_thr_umutex_init(&_mutex_static_lock);
_thr_umutex_init(&_cond_static_lock);
@ -478,6 +477,7 @@ init_private(void)
sysctlbyname("kern.smp.cpus", &_thr_is_smp, &len, NULL, 0);
_thr_is_smp = (_thr_is_smp > 1);
_thr_page_size = getpagesize();
_thr_guard_default = (2 * 1024 * 1024);
_pthread_attr_default.guardsize_attr = _thr_guard_default;
_pthread_attr_default.stacksize_attr = _thr_stack_default;
env = getenv("LIBPTHREAD_SPINLOOPS");
@ -490,19 +490,6 @@ init_private(void)
if (env)
_thr_queuefifo = atoi(env);
TAILQ_INIT(&_thr_atfork_list);
/*
* Initialize the random-sized stack guard
* conservatively.
*/
mib[0] = CTL_KERN;
mib[1] = KERN_ARND;
len = sizeof(npages);
npages = 0;
sysctl(mib, 2, &npages, &len, NULL, 0);
npages %= GUARD_MAX_PAGES;
if (npages < GUARD_MIN_PAGES)
npages = GUARD_DEFAULT_SIZE;
_thr_guard_default = npages * PAGE_SIZE;
}
init_once = 1;
}

View file

@ -101,18 +101,6 @@ TAILQ_HEAD(mutex_queue, pthread_mutex);
#define THR_ASSERT(cond, msg)
#endif
#ifndef GUARD_DEFAULT_SIZE
#define GUARD_DEFAULT_SIZE 512
#endif
#ifndef GUARD_MIN_PAGES
#define GUARD_MIN_PAGES 256
#endif
#ifndef GUARD_MAX_PAGES
#define GUARD_MAX_PAGES 1024
#endif
#ifdef PIC
# define STATIC_LIB_REQUIRE(name)
#else