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

-fno-rtti incompatible with UBSAN fuzzing setup #189

Open
pitrou opened this issue Aug 8, 2024 · 2 comments
Open

-fno-rtti incompatible with UBSAN fuzzing setup #189

pitrou opened this issue Aug 8, 2024 · 2 comments

Comments

@pitrou
Copy link
Contributor

pitrou commented Aug 8, 2024

We have Apache Arrow set up on OSS-Fuzz. Arrow can optionally use Snappy to read Parquet files, but unfortunately Snappy cannot be enabled on some OSS-Fuzz builders because of incompatible compiler options.

See attempted CI run here:
https://github.com/google/oss-fuzz/actions/runs/10306444556/job/28529568675

and in particular these errors:

[1/5] Building CXX object CMakeFiles/snappy.dir/snappy-sinksource.cc.o
FAILED: CMakeFiles/snappy.dir/snappy-sinksource.cc.o 
/usr/local/bin/clang++ -DHAVE_CONFIG_H -I/work/snappy_ep-prefix/src/snappy_ep -O1 -fno-omit-frame-pointer -gline-tables-only -Wno-error=enum-constexpr-conversion -Wno-error=incompatible-function-pointer-types -Wno-error=int-conversion -Wno-error=deprecated-declarations -Wno-error=implicit-function-declaration -Wno-error=implicit-int -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION -fsanitize=array-bounds,bool,builtin,enum,function,integer-divide-by-zero,null,object-size,return,returns-nonnull-attribute,shift,signed-integer-overflow,unsigned-integer-overflow,unreachable,vla-bound,vptr -fno-sanitize-recover=array-bounds,bool,builtin,enum,function,integer-divide-by-zero,null,object-size,return,returns-nonnull-attribute,shift,signed-integer-overflow,unreachable,vla-bound,vptr -fsanitize=fuzzer-no-link -stdlib=libc++ -Qunused-arguments -fcolor-diagnostics -fPIC -Wall -Wextra -Werror -fno-exceptions -fno-rtti -O2 -g -DNDEBUG -ggdb   -Wno-error -std=gnu++17 -MD -MT CMakeFiles/snappy.dir/snappy-sinksource.cc.o -MF CMakeFiles/snappy.dir/snappy-sinksource.cc.o.d -o CMakeFiles/snappy.dir/snappy-sinksource.cc.o -c /work/snappy_ep-prefix/src/snappy_ep/snappy-sinksource.cc
clang++: error: invalid argument '-fsanitize=vptr' not allowed with '-fno-rtti'

[etc.]

It would be nice if Snappy didn't force -fno-rtti unconditionally.

@kou
Copy link

kou commented Aug 14, 2024

It seems that this will not be accepted. See also: #147

kou added a commit to apache/arrow that referenced this issue Aug 16, 2024
### Rationale for this change

Snappy's CMakeLists.txt unconditionally disables RTTI. This is incompatible with some other options, such as activating UBSAN for a fuzzing build:
google/snappy#189

### What changes are included in this PR?

Add `-frtti` at the end of compiler options when compiling a bundled Snappy build.

### Are these changes tested?

On CI; also manually checked that this allows enabling Snappy on OSS-Fuzz builds.

### Are there any user-facing changes?

No.

* GitHub Issue: #43688

Lead-authored-by: Antoine Pitrou <[email protected]>
Co-authored-by: Antoine Pitrou <[email protected]>
Co-authored-by: Sutou Kouhei <[email protected]>
Co-authored-by: Sutou Kouhei <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
@danilak-G
Copy link
Collaborator

I am ok with the idea of removing fno-rtti but I am afraid this is going to break ABI for quite a few users. Need to think and research how it affects ABI, maybe it's just for weird cases

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

No branches or pull requests

3 participants