fix boost stacktrace missing symbol and code line number#343
fix boost stacktrace missing symbol and code line number#343MrGuin wants to merge 1 commit intoeloqdata:mainfrom
Conversation
WalkthroughTwo build configuration options are uncommented in the CMakeLists.txt file to enable Position Independent Executable (PIE) compilation and linking flags for the eloqkv target when boost stacktrace support is enabled. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
CMakeLists.txt(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: githubzilla
Repo: eloqdata/eloqkv PR: 193
File: build_log_service.cmake:103-118
Timestamp: 2025-09-24T09:00:44.250Z
Learning: The build_log_service.cmake file is specifically for building the log_service submodule which only supports ROCKSDB log state, unlike build_eloq_log_service.cmake which handles multiple WITH_LOG_STATE options (MEMORY, ROCKSDB, ROCKSDB_CLOUD_S3, ROCKSDB_CLOUD_GCS). Therefore, requiring RocksDB unconditionally in build_log_service.cmake is the correct behavior.
Learnt from: githubzilla
Repo: eloqdata/eloqkv PR: 193
File: concourse/scripts/build_tarball_open.bash:121-121
Timestamp: 2025-09-26T05:07:45.185Z
Learning: The open log service in build_tarball_open.bash only supports ROCKSDB as the single log state option, unlike the main eloq log service which supports multiple WITH_LOG_STATE options. Therefore, no WITH_LOG_STATE configuration flag is needed for the open log service build.
Learnt from: githubzilla
Repo: eloqdata/eloqkv PR: 193
File: build_log_service.cmake:128-135
Timestamp: 2025-09-24T08:45:08.818Z
Learning: The LOG_STATE_TYPE_RKDB compile definition in build_log_service.cmake is kept unconditional for compatibility reasons, despite architectural concerns about conflicting with WITH_LOG_STATE paradigm.
| target_compile_options(eloqkv PRIVATE -fno-pie) | ||
| target_link_options(eloqkv PRIVATE -no-pie) |
There was a problem hiding this comment.
Critical: Add guard check for eloqkv target existence.
These lines will cause a CMake configuration error if BUILD_ELOQKV_AS_LIBRARY=ON and WITH_BOOST_STACKTRACE=ON because the eloqkv target is only created when BUILD_ELOQKV_AS_LIBRARY=OFF (line 432).
🔎 Proposed fix
option(WITH_BOOST_STACKTRACE "With boost stack trace." OFF)
message("WITH_BOOST_STACKTRACE: " ${WITH_BOOST_STACKTRACE})
-if(WITH_BOOST_STACKTRACE)
+if(WITH_BOOST_STACKTRACE AND NOT BUILD_ELOQKV_AS_LIBRARY)
target_compile_options(eloqkv PRIVATE -fno-pie)
target_link_options(eloqkv PRIVATE -no-pie)
find_library(BOOST_STACKTRACE_LIB boost_stacktrace_backtrace)
target_link_libraries(eloqkv ${BOOST_STACKTRACE_LIB})
add_compile_definitions(BOOST_STACKTRACE_LINK)
endif()📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| target_compile_options(eloqkv PRIVATE -fno-pie) | |
| target_link_options(eloqkv PRIVATE -no-pie) | |
| if(WITH_BOOST_STACKTRACE AND NOT BUILD_ELOQKV_AS_LIBRARY) | |
| target_compile_options(eloqkv PRIVATE -fno-pie) | |
| target_link_options(eloqkv PRIVATE -no-pie) | |
| find_library(BOOST_STACKTRACE_LIB boost_stacktrace_backtrace) | |
| target_link_libraries(eloqkv ${BOOST_STACKTRACE_LIB}) | |
| add_compile_definitions(BOOST_STACKTRACE_LINK) | |
| endif() |
🤖 Prompt for AI Agents
In CMakeLists.txt around lines 440-441, the
target_compile_options/target_link_options calls for eloqkv run unconditionally
but the eloqkv target is only created when BUILD_ELOQKV_AS_LIBRARY is OFF,
causing a configuration error; wrap those two option-setting calls in a guard
that checks if the eloqkv target exists (e.g., using if(TARGET eloqkv) ...
endif()) so the options are applied only when the target is present.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Find and read CMakeLists.txt, focusing on lines around 440-441
if [ -f "CMakeLists.txt" ]; then
echo "=== Context around lines 430-450 ==="
sed -n '430,450p' CMakeLists.txt | cat -n
echo -e "\n=== Broader context (420-460) ==="
sed -n '420,460p' CMakeLists.txt | cat -n
else
echo "CMakeLists.txt not found in root"
# Try to locate it
find . -name "CMakeLists.txt" -type f 2>/dev/null | head -5
fiRepository: eloqdata/eloqkv
Length of output: 3377
Add comment documenting the PIE disable for stacktrace support.
The code disables PIE when boost stacktrace is enabled. While this is necessary for stack trace symbol resolution with the libbacktrace backend, PIE binaries prevent attackers from knowing where executable code is located during security attacks. Add a comment explaining this trade-off.
Note: the code already uses boost_stacktrace_backtrace, which is a reasonable choice. Alternative backends like addr2line have similar limitations with address space layout randomization, so the backend selection is appropriate.
🤖 Prompt for AI Agents
In CMakeLists.txt around lines 440-441, the build currently forces -fno-pie and
-no-pie to disable PIE for boost stacktrace/backtrace symbol resolution; add a
concise comment above these target_compile_options/target_link_options
explaining that PIE is disabled to allow accurate backtrace symbolization when
using boost_stacktrace_backtrace (or similar backends), and call out the
security trade-off (reduced ASLR/harder for attackers to locate code) so
maintainers understand why this flag is required and the associated risk. Ensure
the comment mentions the backend choice (boost_stacktrace_backtrace) and that
alternative backends have similar limitations.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.