koka-lang / libmprompt

Robust multi-prompt delimited control and effect handlers in C/C++
MIT License
106 stars 11 forks source link

FreeBSD 13 test fail: mmap invalid argument #4

Closed gdiazlo closed 3 years ago

gdiazlo commented 3 years ago

Hello

The test are failing on FreeBSD13 (seems they introduced PROT_MAX on this version), with a EINVAL error in mmap call when compiling a release version.

% ./test_mp_async 
run requests...
libmprompt: error: failed to allocate mmap memory of size 274877906944
            code : 22: Invalid argument
libmprompt: error: unable to allocate a stack
4000: signal: sys: abort (core dumped)
% 

Removing PROT_MAX but leaving prot |= PROT_READ | PROT_WRITE the test does not crash, but never ends, eating a single core for more than an hour, with no increase of memory usage. The other tests behave simmilarly.

daanx commented 3 years ago

Ouch -- thanks for the report; I will try to repro this on my VM

daanx commented 3 years ago

Fixed in the latest dev; thanks. Turns out the MAP_STACK option did not work but the PROT_MAX is ok.

gdiazlo commented 3 years ago

Thanks a lot! I'll try it. mmap is such a complex beast :)