Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QEMU: safe linking of extern "C" declarations #1810

Merged
merged 6 commits into from
Jan 23, 2024

Conversation

rmalmain
Copy link
Collaborator

Declared functions in extern "C" blocks are not necessarily checked at link-time if the symbols are not necessary during compilation (unused symbols).

Some symbols could be declared without any definition and still compile correctly.
Someone had this issue with libafl_qemu_trigger_breakpoint being declared in LibAFL without a definition in QEMU.
Calling the wrapper function in a fuzzer resulted in a linker error.

With the new macro extern_c_checked!, it is possible to declare C symbols and still get an error if there is no definition.
It relies on a nightly feature, and thus will only trigger in a nightly build.
Stable builds will work as before.

It is mainly useful to catch those kinds of errors early in the CI.

@domenukk domenukk merged commit a0e30d0 into AFLplusplus:main Jan 23, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants