Skip to content

fix boost stacktrace missing symbol and code line number#343

Open
MrGuin wants to merge 1 commit intoeloqdata:mainfrom
MrGuin:fix_stack_trace
Open

fix boost stacktrace missing symbol and code line number#343
MrGuin wants to merge 1 commit intoeloqdata:mainfrom
MrGuin:fix_stack_trace

Conversation

@MrGuin
Copy link
Collaborator

@MrGuin MrGuin commented Dec 19, 2025

Summary by CodeRabbit

  • Chores
    • Updated build configuration flags to optimize compilation and linking settings.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 19, 2025

Walkthrough

Two 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

Cohort / File(s) Summary
Build configuration updates
CMakeLists.txt
Uncommented target_compile_options and target_link_options for eloqkv to apply -fno-pie and -no-pie flags respectively under the WITH_boost_stacktrace conditional branch

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 The flags were sleeping, tucked away,
Now stacktraces leap to light of day!
No-pie, no-pie, the rabbit cries,
Build it faster, watch it rise!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: uncommenting boost stacktrace compilation flags to fix missing symbols and enable code line number information.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1ec7072 and e20649e.

📒 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.

Comment on lines +440 to +441
target_compile_options(eloqkv PRIVATE -fno-pie)
target_link_options(eloqkv PRIVATE -no-pie)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

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.

Suggested change
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.

⚠️ Potential issue | 🟡 Minor

🧩 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
fi

Repository: 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.

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.

1 participant