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

Selective ubsan #1844

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

anarcheuz
Copy link
Collaborator

@anarcheuz anarcheuz commented May 13, 2024

Set of patches intended to make UBSAN work when fuzzing M2. Currently UBSAN is showing reports that do not appear to be security related during initialization. This allows the fuzzing session to halt on UBSAN reports and be cleaner. I have encountered 2 integer overflows issues in the native programs and think UBSAN would be beneficial for those running the Fuzzers.

The patches are for the Clang build. IIRC when testing, GCC's UBSAN had more false positives (that appeared during compilation) than Clang and was not supporting all sanitize flags of UBSAN (ie. less stable).

I also added unsigned-overflow checks to with-ubsan.mk, as this is targeted for fuzzing.

Note: fd_exec_instr_test.c is an exception that requires modifying CFLAGS for -fno-sanitize=undefined (I did not manage to make it work with __attribute__((no_sanitize("undefined"))) nor __attribute__((no_sanitize("nullability"))) ). This does not prevent dependencies such as native programs to be compiled in with UBSAN.

@ptaffet-jump
Copy link
Contributor

It's probably cleaner to define something like FD_ALLOW_UNSIGNED_OVERFLOW that expands to nothing when not using UBSAN and the attribute when you are.
The bigger issue is that (as far as I know) unsigned integer overflow is actually perfectly defined, so there are probably a lot more places in the code that (correctly) depend on unsigned overflow. Would it be possible to make ubsan overflow checking opt-in, at least for now?

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.

None yet

2 participants