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

Add UBSan build support and UBSan CI workflow #2298

Merged
merged 18 commits into from May 13, 2024

Conversation

mapleFU
Copy link
Member

@mapleFU mapleFU commented May 7, 2024

No description provided.

@mapleFU mapleFU marked this pull request as draft May 7, 2024 05:59
@mapleFU mapleFU marked this pull request as ready for review May 7, 2024 15:20
@mapleFU
Copy link
Member Author

mapleFU commented May 7, 2024

Verified: All test passed with no ubsan error in My M1 MacOS with -DENABLE_ASAN=ON -DENABLE_UBSAN=ON -DDISABLE_JEMALLOC=ON -DASAN_WITH_LSAN=OFF . I can decrease no-sanitize later

@PragmaTwice
Copy link
Member

Could we also add it to the worflow matrix in this PR?
https://github.com/apache/kvrocks/blob/unstable/.github/workflows/kvrocks.yaml

@mapleFU
Copy link
Member Author

mapleFU commented May 10, 2024

Could we also add it to the worflow matrix in this PR? https://github.com/apache/kvrocks/blob/unstable/.github/workflows/kvrocks.yaml

Previously I think we should add after some issue is fixed, let me add it now.

@PragmaTwice PragmaTwice changed the title GH-2297: [Build] Add basic ubsan support Add UBSan build support and UBSan CI workflow May 11, 2024
@mapleFU
Copy link
Member Author

mapleFU commented May 11, 2024

Damn: https://github.com/facebook/rocksdb/pull/12427/files#diff-084cbffee5bd519be89896acbf616c2d8435fbfe699f9dcac7e7ccb3fad7f586

This patch fix a ub in rocksdb 😅, the IOOptions::verify_and_reconstruct_read is not initialized yet

@mapleFU mapleFU mentioned this pull request May 11, 2024
@mapleFU mapleFU requested a review from PragmaTwice May 11, 2024 14:27
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated
else()
message(FATAL_ERROR "Cannot use UBSAN without clang or gcc >= 5.1")
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined -fno-sanitize-recover=all")
Copy link
Member

Choose a reason for hiding this comment

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

Ahh sorry, my idea is to move -fno-sanitize-recover=all out of if, to prevent repeated long statement.

Not add it here.

CMakeLists.txt Outdated
else()
message(FATAL_ERROR "Cannot use UBSAN without clang or gcc >= 5.1")
endif()
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined -fno-sanitize-recover=all")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined -fno-sanitize-recover=all")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize-recover=all")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-sanitize-recover=all")

CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
@PragmaTwice PragmaTwice merged commit a538b90 into apache:unstable May 13, 2024
31 checks passed
Copy link

sonarcloud bot commented May 13, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
2 Security Hotspots

See analysis details on SonarCloud

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

3 participants