Surfacing security issues with OpenBSD as part of the CI with hardened memory allocator
Description
Hi folks,
We are analysing the PHP code and while it's clear that there are performance benefits from PHP current ZendMM allocator, we also see benefits from disabling it as a build option to surface memory corruption security bugs.
OpenBSD has a hardened memory allocator which can surface a lot of those security issues: OpenBSD malloc
Would the PHP team be willing to accept a PR for the CI which adds OpenBSD as a runner for CI builds with USE_ZEND_ALLOC=0 activated ?
@iluuu1994 there is already a FreeBSD VM: https://github.com/php/php-src/blob/master/.github/actions/freebsd/action.yml. We can build the same for OpenBSD with USE_ZEND_ALLOC=0 ? we would be happy to help maintain this as part of the CI as we use OpenBSD a lot.
This is a sensible proposal. OpenBSD hardened allocator can help identify security issues early.
USE_ZEND_ALLOC=0 can leak memory on fatal errors such as timeouts. We're considering getting rid of longjmp() completely, which would make this possible.
@iluuu1994 how can we help with getting rid of longjmp() ?
@iluuu1994 is the first step deprecating use of longjmp() in different parts of the code ? Can we start with extensions ?
@loganaden We don't know yet. Some things like timeout can switch from bailout to a GracefulExit, like soft-OOM does. Other things like E_ERROR might have to switch to _exit(). There were some complications when we looked at this, like preloading depending on catchable longjmp(). _exit() can also be problematic for ZTS.
@iluuu1994 can we send a PR for OpenBSD in the CI ?
@loganaden Not sure what specifically you're referring to. 🙂 But sure, unless there are security implications you can send any PR.
@iluuu1994 we would like to send a 1st PR to have OpenBSD 8.0 as part of the PHP CI, in addition to FreeBSD. Then, later once everybody is comfortable we can enable more mitigations on OpenBSD ?
@loganaden We could consider OpenBSD for nightly, yes. (I.e. executed once per day per branch, rather than for ever push/PR)
OpenBSD CI would be good as it would give us LibreSSL. It should be on the same level as Solaris which means nightly and optional label trigger.