Skip to content

Commit

Permalink
aws-iot-device-sdk-cpp-v2: add openssl sanitizer suppression
Browse files Browse the repository at this point in the history
(cherry picked from commit df1f18b)
  • Loading branch information
thomas-roos authored and github-actions[bot] committed Feb 12, 2025
1 parent d1651fb commit d5a2d8d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,10 @@ SOLIBS = "*.so"
FILES_SOLIBSDEV = ""

BBCLASSEXTEND = "native nativesdk"

# -fsanitize=address does cause this
# nooelint: oelint.vars.insaneskip:INSANE_SKIP
INSANE_SKIP += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', 'buildpaths', '', d)}"

PACKAGECONFIG[sanitize] = ",, gcc-sanitizers"
OECMAKE_CXX_FLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', '-fsanitize=address,undefined -fno-omit-frame-pointer', '', d)}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Suppress OpenSSL CRYPTO_malloc leaks
leak:CRYPTO_malloc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

export LD_PRELOAD=$(find /usr/lib /lib -type f -name "libasan.so*")

mqtt5_pubsub --help
LSAN_OPTIONS=suppressions=openssl_suppressions.txt mqtt5_pubsub --help
RETVAL=$?
if [ $RETVAL -eq 255 ] ; then
echo "PASS: aws-iot-device-sdk-cpp-v2-sample-mqtt5_pubsub help test"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ require aws-iot-device-sdk-cpp-v2-version.inc

SRC_URI:append = " \
file://run-ptest \
file://openssl_suppressions.txt \
"

S = "${WORKDIR}/git"
Expand Down Expand Up @@ -41,7 +42,7 @@ PACKAGECONFIG ??= "\
${@bb.utils.contains('PTEST_ENABLED', '1', 'with-tests', '', d)} \
"
PACKAGECONFIG[with-tests] = "-DBUILD_TESTING=ON,-DBUILD_TESTING=OFF,"
#TODO PACKAGECONFIG:append:x86-64 = " ${@bb.utils.contains('PTEST_ENABLED', '1', 'sanitize', '', d)}"
PACKAGECONFIG:append:x86-64 = " ${@bb.utils.contains('PTEST_ENABLED', '1', 'sanitize', '', d)}"

FILES:${PN}-dev += "${libdir}/*/cmake"

Expand All @@ -53,9 +54,15 @@ BBCLASSEXTEND = "native nativesdk"

EXTRA_OECMAKE:append = " -DCMAKE_BUILD_TYPE=RelWithDebInfo"

#TODO # -fsanitize=address does cause this
#TODO # nooelint: oelint.vars.insaneskip:INSANE_SKIP
#TODO INSANE_SKIP += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', 'buildpaths', '', d)}"
# -fsanitize=address does cause this
# nooelint: oelint.vars.insaneskip:INSANE_SKIP
INSANE_SKIP += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', 'buildpaths', '', d)}"

#TODO PACKAGECONFIG[sanitize] = ",, gcc-sanitizers"
#TODO OECMAKE_CXX_FLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', '-fsanitize=address,undefined -fno-omit-frame-pointer', '', d)}"
PACKAGECONFIG[sanitize] = ",, gcc-sanitizers"
OECMAKE_CXX_FLAGS += "${@bb.utils.contains('PACKAGECONFIG', 'sanitize', '-fsanitize=address,undefined -fno-omit-frame-pointer', '', d)}"

do_install_ptest:append() {
install -d ${D}${PTEST_PATH}/tests

install ${UNPACKDIR}/openssl_suppressions.txt ${D}${PTEST_PATH}/
}

0 comments on commit d5a2d8d

Please sign in to comment.