From 04e34b829779c8c6d5b000c1b63c6d781821e4be Mon Sep 17 00:00:00 2001 From: deraadt <> Date: Mon, 5 Mar 2018 01:15:26 +0000 Subject: [PATCH] #define _MAX_PAGE_SHIFT in MD _types.h as the maximum pagesize an arch needs (looking at you sgi, but others required this before). This is for the circumstances we need pagesize known at compile time, not getpagesize() runtime. Use it for malloc storage sizes, for shm, and to set pthread stack default sizes. The stack sizes were a mess, and pushing them towards page-aligned is healthy move (which will also be needed by the coming stack register checker) ok guenther kettenis, discussion with stefan --- src/include/pthread.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/include/pthread.h b/src/include/pthread.h index ecbb76a5..cfb1356a 100644 --- a/src/include/pthread.h +++ b/src/include/pthread.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pthread.h,v 1.3 2017/11/04 22:53:57 jca Exp $ */ +/* $OpenBSD: pthread.h,v 1.4 2018/03/05 01:15:26 deraadt Exp $ */ /* * Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu @@ -51,7 +51,7 @@ */ #define PTHREAD_DESTRUCTOR_ITERATIONS 4 #define PTHREAD_KEYS_MAX 256 -#define PTHREAD_STACK_MIN 2048 +#define PTHREAD_STACK_MIN (1U << _MAX_PAGE_SHIFT) #define PTHREAD_THREADS_MAX ULONG_MAX /*