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

Zstd builds fail with dfsan + hand written assembly #6513

Closed
terrelln opened this issue Sep 23, 2021 · 3 comments
Closed

Zstd builds fail with dfsan + hand written assembly #6513

terrelln opened this issue Sep 23, 2021 · 3 comments

Comments

@terrelln
Copy link
Contributor

We recently added some hand written assembly for a hot loop in zstd. After that our builds started failing with undefined symbol HUF_decompress4X2_usingDTable_internal_bmi2_asm_loop.dfsan errors. HUF_decompress4X2_usingDTable_internal_bmi2_asm_loop is our ASM function. This seems related to data flow sanitizer

We have the ability to disable the assembly implementation with a macro. E.g. by detecting __has_feature(dataflow_sanitizer) and disabling it. Is there a better way handle it?

@DavidKorczynski
Copy link
Collaborator

DavidKorczynski commented Sep 23, 2021

Am not sure, but is this an issue that happens in general or does the issue only happen in the OSS-Fuzz environment? If it's related to dfsan in general perhaps they will have better knowledge about it in the llvm repo: https://github.com/llvm/llvm-project/tree/main/compiler-rt/lib/dfsan

With that said, with limited knowledge of dfsan I could imagine it heavily relying on instrumenting LLVM IR and inline assembly will break that as dfsan can't instrument the assembly. Perhaps it's related to the ABI lists: https://clang.llvm.org/docs/DataFlowSanitizer.html#id5
Quote from the paragraph: "DataFlowSanitizer comes with a default ABI list which is intended to eventually cover the glibc library on Linux but it may become necessary for users to extend the ABI list in cases where a particular library or function cannot be instrumented (e.g. because it is implemented in assembly or another language which DataFlowSanitizer does not support)"

@terrelln
Copy link
Contributor Author

Thanks for the advice! I've just disabled the ASM implementation when dfsan is enabled in facebook/zstd#2799.

@jonathanmetzman
Copy link
Contributor

Thanks for the advice! I've just disabled the ASM implementation when dfsan is enabled in facebook/zstd#2799.

I would have just disabled dfsan. We aren't paying attention to it anymore, as it was Max Moroz who was doing that and he left Google.

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