Commit Graph

32 Commits

Author SHA1 Message Date
George Koehler
7e14ab9e45 Use mmap(2) MAP_STACK to allocate stacks on OpenBSD
Since OpenBSD 6.4 (https://www.openbsd.org/64.html), the stack pointer
must point to MAP_STACK memory, or the kernel may kill the process
with a signal.  All stack allocators must pass MAP_STACK to mmap(2).

Define BOOST_CONTEXT_USE_MAP_STACK on OpenBSD, and don't define it on
other systems.  This doesn't check for old versions of OpenBSD without
MAP_STACK; but OpenBSD has stopped maintaining versions before 6.4.

If BOOST_CONTEXT_USE_MAP_STACK is defined, then cause the stack
allocators to pass MAP_STACK to mmap(2):

 - fixedsize_stack uses mmap/munmap instead of malloc/free.  This
   comes from a patch in OpenBSD Ports.

 - protected_fixedsize_stack adds MAP_STACK to the mmap flags (as it
   does in OpenBSD Ports).  Assume that systems with MAP_STACK also
   have MAP_ANON; this is true on OpenBSD.  Delete POSIX comment,
   because I can't find MAP_ANON nor MAP_ANONYMOUS in POSIX, so these
   mmap calls don't conform to POSIX.

 - pooled_fixedsize_stack can't call munmap, because the pool's free
   doesn't know the allocation's size.  Instead use posix_memalign to
   allocate memory, then mmap to replace the pages with MAP_STACK
   pages, so the pool's free may call std::free.

OpenBSD has no <ucontext.h>, so edit test/Jamfile.v2 to skip ucontext
tests on OpenBSD.

This commit and https://github.com/boostorg/test/pull/231 causes
libs/context/test `b2 full` to pass on OpenBSD 6.5 for 64-bit x86.
`b2 fc` fails because the allocator in test_fcontext.cpp does not use
MAP_STACK.  The tests seem not to cover pooled_fixedsize_stack nor
protected_fixedsize_stack, but they still pass when I temporarily hack
callcc to use those allocators instead of fixedsize_stack.
2019-10-03 20:47:36 -04:00
Oliver Kowalke
0c754f90c5 execution_context removed 2019-08-29 13:42:03 +02:00
Oliver Kowalke
ca7301cc55 build unit-tests as release 2018-05-26 07:18:25 +02:00
Oliver Kowalke
40c312b590 uint-tests using segmented stacks 2018-04-05 08:08:45 +02:00
Oliver Kowalke
aef5de1aa9 unit-test: rename rule to 'native-impl' 2018-02-19 16:09:23 +01:00
Oliver Kowalke
2b1bf36545 unit-tests: exclude android from using ucontext 2018-02-19 15:09:49 +01:00
Oliver Kowalke
388a255ee8 rvalue-ref qualified resume()/resume_with() only 2018-02-09 17:27:35 +01:00
Oliver Kowalke
7c3a6b51c5 mark execution_context (v1) as deprecated 2018-02-08 09:56:22 +01:00
Oliver Kowalke
c7d01f1854 disable buildng unit-test with ucontext for MacOS X 2018-02-06 19:42:57 +01:00
Oliver Kowalke
a0433d1c72 execution_context without depended compilation
- execution_context v1 in namecpase v1
- execution_context v2 in inlined namespace v2
2018-02-05 19:34:35 +01:00
Oliver Kowalke
51ea6b583d re-introduce continuation - fix conflicts 2018-02-05 13:31:35 +01:00
Oliver Kowalke
10d3264f7b implementation of fibers without scheduler according to P0876R0 2018-02-05 13:31:32 +01:00
Oliver Kowalke
05646ee266 build unit-tests with variant release 2017-06-11 19:12:01 +02:00
Oliver Kowalke
01365a56c1 keep debug symbols in unit-tests 2017-06-04 20:27:03 +02:00
Oliver Kowalke
82e307a5ad add unit-test for call/cc for native APIs 2017-06-04 20:27:03 +02:00
Oliver Kowalke
d61ee3c66c unit-tests: build parameters speed/release 2017-06-04 20:27:03 +02:00
Oliver Kowalke
fa890b1c4d adapt Jamfiles for new properties 2017-06-04 20:27:03 +02:00
oliver Kowalke
7ab9ace7b3 introduction of callcc()/continuation<> 2016-12-25 21:23:04 +01:00
oliver Kowalke
7db7873401 enable unit-test only if <thread> is supported 2016-12-13 08:06:01 +01:00
Oliver Kowalke
ba3673d9cb add unit-tests for fcontext 2016-11-26 19:45:39 +01:00
oliver Kowalke
ff4f933429 unit-tests: use defect macro for thread_local 2016-09-15 08:51:50 +02:00
oliver Kowalke
ae66946c06 fix test/Jamfile.v2 requirements 2016-06-17 08:18:46 +02:00
Oliver Kowalke
68a57f29b3 rename captued_context to execution_context
- split into execution_context v2 (previous captured_context)
  and execution_context v1
- v1 enabled if segmented-stacks=on at b2 commandline
2016-02-06 12:18:38 +01:00
Oliver Kowalke
c3296606c1 remove unit-test for fcontext_t 2016-01-13 16:58:44 +01:00
Oliver Kowalke
ba357205a9 class captured_context added 2016-01-01 22:03:18 +01:00
Oliver Kowalke
0ec3ad70a6 re-factor apply()/invoke() + unit-tests 2015-12-11 19:44:11 +01:00
Oliver Kowalke
4380967c80 relax to C++11 2015-12-08 17:46:09 +01:00
Oliver Kowalke
01660915c1 reorder test macros in unit-test 2015-10-11 09:07:43 +02:00
Oliver Kowalke
16abb31ae8 add checks for C++11/14 features in unit-tests 2015-06-21 18:42:55 +02:00
Oliver Kowalke
fa078765cb me stack-allocators/some fixes 2015-01-23 22:02:20 +01:00
Oliver Kowalke
d0ab46ad5c use std::call_once + lambda in stack_traits init
- stack_traits uses std::call_once for static initialization
2015-01-15 18:31:45 +01:00
Oliver Kowalke
b8fd549bac initial commit of boost.context
[SVN r76974]
2012-02-11 13:04:55 +00:00