Add librelp ptest patch for FIPS

wp-librelp-openssl-cleanup
Paul Adelsbach 2025-12-17 13:03:35 -08:00
parent c2aeaed1e0
commit 7717654628
6 changed files with 77 additions and 0 deletions

View File

@ -0,0 +1,71 @@
From 8ad60c7887c78364fd208e96359f3cf033cb8e48 Mon Sep 17 00:00:00 2001
From: WolfSSL <info@wolfssl.com>
Date: Tue, 16 Dec 2025 18:55:00 -0800
Subject: [PATCH] tests: add Valgrind suppression for glibc ld.so strlen false
positives
glibc's dynamic loader uses optimized strlen() implementations
that may read past the end of allocated strings while loading
shared objects via dlopen().
Valgrind reports this behavior as "Invalid read of size 16",
even though it is safe and expected. This causes noise when
running the librelp test suite under Valgrind, especially when
TLS backends are loaded dynamically.
Add a Valgrind suppression file and enable it in the test
framework to filter out these known false positives.
No functional changes.
Signed-off-by: WolfSSL <info@wolfssl.com>
---
tests/test-framework.sh | 8 ++++----
tests/valgrind.supp | 11 +++++++++++
2 files changed, 15 insertions(+), 4 deletions(-)
create mode 100644 tests/valgrind.supp
diff --git a/tests/test-framework.sh b/tests/test-framework.sh
index 9ac2c56..b4d489f 100644
--- a/tests/test-framework.sh
+++ b/tests/test-framework.sh
@@ -4,9 +4,9 @@
# Copyright (C) 2018 by Rainer Gerhards
# "config settings" for the testbench
-TB_TIMEOUT_STARTUP=400 # 40 seconds - Solaris sometimes needs this...
+TB_TIMEOUT_STARTUP=2000 # Extend timeout for FIPS
export LIBRELP_DYN="$(tr -dc 'a-zA-Z0-9' < /dev/urandom | head --bytes 4)"
-export valgrind="valgrind --malloc-fill=ff --free-fill=fe --log-fd=1"
+export valgrind="valgrind --malloc-fill=ff --free-fill=fe --log-fd=1 --suppressions=$PWD/valgrind.supp"
# **** use the line below for very hard to find leaks! *****
# export valgrind="valgrind --malloc-fill=ff --free-fill=fe --log-fd=1 --leak-check=full --show-leak-kinds=all"
# export OPT_VERBOSE=-v # uncomment for debugging
@@ -67,8 +67,8 @@ startup_receiver_valgrind() {
printf 'libtool command not available, cannot run under valgrind\n'
exit 77
fi
- printf 'Starting Receiver...\n'
- libtool --mode=execute $valgrind ./receive $TLSLIB -p $TESTPORT -O $OUTFILE.2 -F $RECEIVE_PIDFILE $OPT_VERBOSE $* &
+ printf 'Starting Receiver with extended timeout for FIPS and valgrind...\n'
+ libtool --mode=execute $valgrind ./receive $TLSLIB -W 300 -p $TESTPORT -O $OUTFILE.2 -F $RECEIVE_PIDFILE $OPT_VERBOSE $* &
export RECEIVE_PID=$!
printf "got $RECEIVE_PID $RECEIVE_PIDFILE\n"
wait_process_startup_via_pidfile $RECEIVE_PIDFILE
diff --git a/tests/valgrind.supp b/tests/valgrind.supp
new file mode 100644
index 0000000..c8807f3
--- /dev/null
+++ b/tests/valgrind.supp
@@ -0,0 +1,11 @@
+# Suppress glibc ld.so false positives caused by
+# optimized strlen() reading past the NUL terminator
+# Seen when librelp dynamically loads TLS backends
+
+{
+ glibc_ldso_dlopen_strlen
+ Memcheck:Addr16
+ fun:strlen
+ fun:_dl_new_object
+ ...
+}

View File

@ -0,0 +1,2 @@
FILESEXTRAPATHS:prepend := "${THISDIR}/files:"
SRC_URI:append:class-target = " file://librelp-ptest.patch"

View File

@ -0,0 +1 @@
require ${WOLFSSL_LAYERDIR}/inc/librelp/librelp-ptest.inc

View File

@ -0,0 +1 @@
require ${WOLFSSL_LAYERDIR}/inc/librelp/librelp-ptest.inc

View File

@ -39,6 +39,7 @@ IMAGE_INSTALL:append = " \
binutils \
ldd \
curl \
librelp-ptest \
"
require recipes-core/images/core-image-minimal.bb

View File

@ -0,0 +1 @@
require ${WOLFSSL_LAYERDIR}/inc/librelp/librelp-ptest.inc