MAP_STACK is also needed for basic_standard_stack_allocator, found while

testing Icinga 2 development code.  Looks good to otto@, ok Brad
This commit is contained in:
sthen 2019-07-18 20:27:25 +00:00
parent 8da3fa01fa
commit e40db86e25
2 changed files with 37 additions and 2 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.87 2019/07/12 20:44:04 sthen Exp $
# $OpenBSD: Makefile,v 1.88 2019/07/18 20:27:25 sthen Exp $
COMMENT-main= free peer-reviewed portable C++ source libraries
COMMENT-md= machine-dependent libraries for boost
@ -9,11 +9,12 @@ VERSION= 1.66.0
DISTNAME= boost_${VERSION:S/./_/g}
PKGNAME-main= boost-${VERSION}
PKGNAME-md= boost-md-${VERSION}
REVISION-main= 5
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE:=boost/}
EXTRACT_SUFX= .tar.bz2
FIX_EXTRACT_PERMISSIONS = Yes
REVISION-main= 6
REVISION-md= 1
SO_VERSION= 9.0

View File

@ -0,0 +1,34 @@
$OpenBSD: patch-boost_coroutine_standard_stack_allocator_hpp,v 1.1 2019/07/18 20:27:25 sthen Exp $
Index: boost/coroutine/standard_stack_allocator.hpp
--- boost/coroutine/standard_stack_allocator.hpp.orig
+++ boost/coroutine/standard_stack_allocator.hpp
@@ -26,6 +26,8 @@
# include BOOST_ABI_PREFIX
#endif
+#include <sys/mman.h>
+
namespace boost {
namespace coroutines {
@@ -39,8 +41,8 @@ struct basic_standard_stack_allocator
BOOST_ASSERT( traits_type::minimum_size() <= size);
BOOST_ASSERT( traits_type::is_unbounded() || ( traits_type::maximum_size() >= size) );
- void * limit = std::malloc( size);
- if ( ! limit) throw std::bad_alloc();
+ void * limit = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON | MAP_STACK, -1, 0);
+ if ( limit == MAP_FAILED ) throw std::bad_alloc();
ctx.size = size;
ctx.sp = static_cast< char * >( limit) + ctx.size;
@@ -60,7 +62,7 @@ struct basic_standard_stack_allocator
#endif
void * limit = static_cast< char * >( ctx.sp) - ctx.size;
- std::free( limit);
+ munmap(limit, ctx.size);
}
};