File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -60,17 +60,22 @@ jobs:
6060 grep -v 'would read block' /tmp/c.out | head -12
6161 exit $rc
6262
63- - name : memory-bio-dtls -- backtrace the dtls1.2 segfault
63+ - name : memory-bio-dtls -- does the up_ref fix work
6464 if : always()
6565 run : |
6666 cd dtls
6767 export LD_LIBRARY_PATH=/tmp/inst/lib
68+ gcc -g -O0 -o /tmp/mb13 memory-bio-dtls.c -I/tmp/inst/include \
69+ -L/tmp/inst/lib -lwolfssl -lpthread -lm || exit 1
6870 sed 's/#ifdef WOLFSSL_DTLS13/#if 0/' memory-bio-dtls.c > /tmp/mb12.c
6971 gcc -g -O0 -o /tmp/mb12 /tmp/mb12.c -I/tmp/inst/include \
7072 -L/tmp/inst/lib -lwolfssl -lpthread -lm || exit 1
71- ulimit -c unlimited
72- echo "=== confirm the forced method:"
73- grep -n -A4 '#if 0' /tmp/mb12.c | head -8
74- echo "=== run under gdb:"
75- gdb -batch -ex run -ex 'thread apply all bt' --args /tmp/mb12 2>&1 \
76- | grep -vE '^\[|^Reading|^Downloading|^warning:' | tail -40
73+ bad=0
74+ for v in 13 12; do
75+ timeout 15 /tmp/mb$v > /tmp/o$v.txt 2>&1
76+ rc=$?
77+ echo "=== DTLS 1.$v : rc=$rc (0=works, 124=hang, 139=segv)"
78+ cat /tmp/o$v.txt | head -8
79+ [ $rc -eq 0 ] || bad=1
80+ done
81+ exit $bad
Original file line number Diff line number Diff line change @@ -119,8 +119,7 @@ static void* client_thread(void* args)
119119 } while (ret <= 0 &&
120120 ((err == WOLFSSL_ERROR_WANT_READ ) || (err == WOLFSSL_ERROR_WANT_WRITE )));
121121
122- /* clean up, wolfSSL_free would also free the WOLFSSL_BIO's so set as NULL
123- * since they are also being used with srv_ssl and will be free'd there. */
122+ /* drops this thread's BIO references; srv_ssl still holds its own */
124123 wolfSSL_set_bio (cli_ssl , NULL , NULL );
125124 wolfSSL_free (cli_ssl );
126125 wolfSSL_CTX_free (cli_ctx );
@@ -147,6 +146,10 @@ int main()
147146
148147 io .rbio = wolfSSL_BIO_new (wolfSSL_BIO_s_mem ());
149148 io .wbio = wolfSSL_BIO_new (wolfSSL_BIO_s_mem ());
149+ /* cli_ssl and srv_ssl both use these, so take the second reference here or
150+ * whichever side cleans up first frees them under the other. */
151+ wolfSSL_BIO_up_ref (io .rbio );
152+ wolfSSL_BIO_up_ref (io .wbio );
150153 sem_init (& io .bioSem , 0 , 1 );
151154
152155 /* set up server */
You can’t perform that action at this time.
0 commit comments