See details in https://github.com/libevent/libevent/issues/615. The patches can be dropped after we move to the next stable release.