What changed, and why it matters
This commit adds an optional logging switch to libjade, a Linux build of the Jade firmware used for in-process debugging. By default logging remains disabled, but developers can now turn it on with a --log flag. There is no security vulnerability here; it is a build/debugging convenience change.
No security action required. Treat as a normal build-system enhancement. If logging is enabled, ensure it is only used in debug/test environments and not in release builds, which the default OFF option already supports.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The change introduces a CMake option LOG (default OFF) and a –log argument to make_libjade.sh. When LOG is OFF, the build defines CONFIG_LOG_DEFAULT_LEVEL_NONE, preserving the previous no-logging default. When LOG is ON, that define is omitted so firmware logging macros can emit output. The esp_log.h macros are also updated to prefix messages with DEBUG:/INFO:/WARN:/ERROR: and no longer include sdkconfig.h directly. This is purely a developer/debugging feature with no runtime security effect on production Jade firmware.
Changed components
libjade build system (CMakeLists.txt, make_libjade.sh)libjade esp_log.h headerInspect captured patch +34 / −14
diff --git a/libjade/CMakeLists.txt b/libjade/CMakeLists.txt
index 90e69b3..cdd4e80 100644
--- a/libjade/CMakeLists.txt
+++ b/libjade/CMakeLists.txt
@@ -43,6 +43,11 @@ if(CMAKE_BUILD_TYPE STREQUAL "Sanitize")
add_link_options(-fsanitize=address -fsanitize=undefined -fsanitize=alignment -fsanitize-address-use-after-scope -fno-sanitize-recover=all)
endif()
+option(LOG "Enable libjade logging" OFF)
+if (NOT LOG)
+ add_compile_options(-DCONFIG_LOG_DEFAULT_LEVEL_NONE)
+endif()
+
set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)
diff --git a/libjade/include/esp_log.h b/libjade/include/esp_log.h
index 03ca45d..7f337fc 100644
--- a/libjade/include/esp_log.h
+++ b/libjade/include/esp_log.h
@@ -1,7 +1,6 @@
#ifndef __LIBJADE_ESP_LOG__
#define __LIBJADE_ESP_LOG__ 1
-#include "sdkconfig.h"
#include <stdio.h>
typedef enum {
@@ -22,22 +21,22 @@ extern esp_log_level_t _libjade_log_level;
#define ESP_LOGD(f, fmt, ...) \
do { \
if (_libjade_log_level <= ESP_LOG_DEBUG) \
- fprintf(stderr, f ":" fmt "\n", __VA_ARGS__); \
+ fprintf(stderr, "DEBUG:" f ":" fmt "\n", __VA_ARGS__); \
} while (0)
#define ESP_LOGI(f, fmt, ...) \
do { \
if (_libjade_log_level <= ESP_LOG_INFO) \
- fprintf(stderr, f ":" fmt "\n", __VA_ARGS__); \
+ fprintf(stderr, "INFO:" f ":" fmt "\n", __VA_ARGS__); \
} while (0)
#define ESP_LOGW(f, fmt, ...) \
do { \
if (_libjade_log_level <= ESP_LOG_WARN) \
- fprintf(stderr, f ":" fmt "\n", __VA_ARGS__); \
+ fprintf(stderr, "WARN:" f ":" fmt "\n", __VA_ARGS__); \
} while (0)
#define ESP_LOGE(f, fmt, ...) \
do { \
if (_libjade_log_level <= ESP_LOG_ERROR) \
- fprintf(stderr, f ":" fmt "\n", __VA_ARGS__); \
+ fprintf(stderr, "ERROR:" f ":" fmt "\n", __VA_ARGS__); \
} while (0)
static inline void esp_log_level_set(const char* tag, esp_log_level_t level)
diff --git a/libjade/include/sdkconfig.h b/libjade/include/sdkconfig.h
index dc1abd6..b409d2c 100644
--- a/libjade/include/sdkconfig.h
+++ b/libjade/include/sdkconfig.h
@@ -10,9 +10,6 @@
#define CONFIG_DEBUG_UNATTENDED_CI 1
#define CONFIG_DEBUG_UNATTENDED_CI_TIMEOUT_MS 1
-// Default to no logging
-#define CONFIG_LOG_DEFAULT_LEVEL_NONE
-
// Tell the firmware code we are building libjade
#define CONFIG_LIBJADE 1
diff --git a/libjade/make_libjade.sh b/libjade/make_libjade.sh
index 97b0a70..fa89d77 100755
--- a/libjade/make_libjade.sh
+++ b/libjade/make_libjade.sh
@@ -2,19 +2,38 @@
#
# Build the Jade firmware into a shared library for in-process debugging
#
-# ./libjade/make_libjade.sh [Debug|Release|RelWithDebInfo|MinSizeRel|Sanitize]
+# ./libjade/make_libjade.sh [Debug|Release|RelWithDebInfo|MinSizeRel|Sanitize] [--log]
#
set -e
-BUILD_TYPE="${1:-Debug}"
+BUILD_TYPE="Debug"
+LOG="0"
-rm -rf build_linux
-mkdir build_linux
+# iterate through optional arguments and set variables accordingly
+for arg in "$@"; do
+ case $arg in
+ Debug|Release|RelWithDebInfo|MinSizeRel|Sanitize)
+ BUILD_TYPE="$arg"
+ shift
+ ;;
+ --log)
+ LOG="LOG"
+ shift
+ ;;
+ *)
+ echo "Unknown argument: $arg"
+ echo "Usage: $0 [Debug|Release|RelWithDebInfo|MinSizeRel|Sanitize] [--log]"
+ exit 1
+ ;;
+ esac
+done
+
+mkdir -p build_linux
cd build_linux
if [ "${BUILD_TYPE}" == "Sanitize" ]; then
- cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_C_FLAGS"-fsanitize=undefined" -DCMAKE_CXX_FLAGS"-fsanitize=undefined" ..
+ cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DCMAKE_C_FLAGS"-fsanitize=undefined" -DCMAKE_CXX_FLAGS"-fsanitize=undefined" -DLOG=${LOG} ..
else
- cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ..
+ cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DLOG=${LOG} ..
fi
make -j8
cd ..
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.