Skip to content

link with Clang static fuzzer lib if UMF_BUILD_FUZZTESTS is set #1284

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

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

Conversation

bratpiorka
Copy link
Contributor

@bratpiorka bratpiorka commented Apr 23, 2025

Link with the Clang static fuzzer library, libclang_rt.fuzzer_no_main-x86_64, if UMF_BUILD_FUZZTESTS is set.
Additionally, run extra tests in the nightly workflow that would fail without this change.

Successful run: https://github.com/oneapi-src/unified-memory-framework/actions/runs/14616987712/job/41010729530?pr=1284

-- Found fuzzer lib: /usr/lib/llvm-18/lib/clang/18/lib/linux/libclang_rt.fuzzer_no_main-x86_64.a
...
-- Fuzzing tests enabled.

Fixes: #590

@bratpiorka bratpiorka changed the title todo link with Clang static fuzzer lib if UMF_BUILD_FUZZTESTS is set Apr 23, 2025
@bratpiorka bratpiorka force-pushed the rrudnick_fuzz_fix branch 7 times, most recently from 661b67d to 9a038b3 Compare April 23, 2025 09:53
@bratpiorka bratpiorka marked this pull request as ready for review April 23, 2025 09:53
@bratpiorka bratpiorka requested a review from a team as a code owner April 23, 2025 09:53
@bratpiorka bratpiorka force-pushed the rrudnick_fuzz_fix branch 3 times, most recently from 0d8eccc to 97d5697 Compare April 23, 2025 11:27
workflow_dispatch:
schedule:
- cron: '0 4 * * *'
push:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls revert

FUZZER_NO_MAIN_LIB
NAMES libclang_rt.fuzzer_no_main-x86_64.a
PATHS
"/usr/lib/llvm-${CMAKE_C_COMPILER_MAJOR_VERSION}/lib/clang/${CMAKE_C_COMPILER_MAJOR_VERSION}/lib/linux/"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we use CMAKE_PREFIX_PATH or some custom var to include here - then in case of error we could print a msg like - "use <var> to set up the path for the clang libs..."

I can imagine that this hardcoded "/usr/lib/llvm-${CMAKE_C_COMPILER_MAJOR_VERSION}/lib..." path will not work on some distros...

# Fuzzer instrumentation for the whole library
if(UMF_BUILD_FUZZTESTS
AND CMAKE_CXX_COMPILER_ID MATCHES "Clang"
AND LINUX)
add_compile_options("-fsanitize=fuzzer-no-link")
add_link_options("-fsanitize=fuzzer-no-link")

# We need to find the fuzzer lib in the LLVM installation dir and link it
# statically
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and why...?

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.

libumf.so.0: undefined symbol: __sancov_lowest_stack
2 participants