Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,8 @@ option(WITH_BOOST_STACKTRACE "With boost stack trace." OFF)
message("WITH_BOOST_STACKTRACE: " ${WITH_BOOST_STACKTRACE})

if(WITH_BOOST_STACKTRACE)
# target_compile_options(eloqkv PRIVATE -fno-pie)
# target_link_options(eloqkv PRIVATE -no-pie)
target_compile_options(eloqkv PRIVATE -fno-pie)
target_link_options(eloqkv PRIVATE -no-pie)
Comment on lines +440 to +441
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.

find_library(BOOST_STACKTRACE_LIB boost_stacktrace_backtrace)
target_link_libraries(eloqkv ${BOOST_STACKTRACE_LIB})
add_compile_definitions(BOOST_STACKTRACE_LINK)
Expand Down