Page MenuHomeFreeBSD

libarchive: fix mismatch between library and test configuration
ClosedPublic

Authored by arichardson on Sep 17 2020, 5:04 PM.

Details

Summary

I was investigating libarchive test failures on FreeBSD and it turns out
we get a reproducible SIGBUS for test_archive_m5, etc. Debugging this shows
that libarchive and the tests disagree when it comes to the definition of
archive_md5_ctx: libarchive assumes it's the OpenSSL type whereas the test
use the libmd type. The latter is not necessarily aligned enough to store
a pointer (16 bytes for CHERI RISC-V), so we were crashing when storing
EVP_MD_CTX* to an 8-byte-aligned archive_md5_ctx.

To avoid problems like this in the future, factor out the common compiler
flags into a Makefile.inc and include that from the tests Makefile.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

arichardson created this revision.

add missing .include <src.opts.mk>

LGTM, have you also sent a mail to mm@?

This revision is now accepted and ready to land.Sep 17 2020, 5:10 PM

LGTM, have you also sent a mail to mm@?

No, but I also submitted https://github.com/libarchive/libarchive/pull/1437 for some further sanity checks.