InterLinked1 / lbbs

Lightweight BBS For Linux - Bulletin Board System server software
GNU General Public License v2.0
35 stars 4 forks source link

tls.c: Segfault when calling SSL_read after a while? #10

Closed InterLinked1 closed 1 year ago

InterLinked1 commented 1 year ago

Segfault that I've observed a few times, when calling SSL_read, specifically when receiving emails, but most likely related to the amount or velocity of data going through tls.c:

Prior to crash:

[2023-06-03 14:34:09.003]   DEBUG[4807]: net_smtp.c:2791 smtp_process: 0x7f456e7f3030 <= 354 Start mail input; end with a period on a line by itself
[2023-06-03 14:34:10.009]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [229 data bytes]
[2023-06-03 14:34:10.010]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [68 data bytes]
[2023-06-03 14:34:10.010]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [123 data bytes]
[2023-06-03 14:34:10.010]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [209 data bytes]
[2023-06-03 14:34:10.010]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [29 data bytes]
[2023-06-03 14:34:10.010]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [83 data bytes]
[2023-06-03 14:34:10.010]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [44 data bytes]
[2023-06-03 14:34:10.010]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [75 data bytes]
[2023-06-03 14:34:10.010]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [88 data bytes]
[2023-06-03 14:34:10.010]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [82 data bytes]
[2023-06-03 14:34:10.010]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [62 data bytes]
[2023-06-03 14:34:10.010]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [60 data bytes]
[2023-06-03 14:34:10.010]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [69 data bytes]
[2023-06-03 14:34:10.010]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [77 data bytes]
[2023-06-03 14:34:10.010]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [49 data bytes]
[2023-06-03 14:34:10.010]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [56 data bytes]
[2023-06-03 14:34:10.010]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [76 data bytes]
[2023-06-03 14:34:10.010]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [77 data bytes]
[2023-06-03 14:34:10.010]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [77 data bytes]
[2023-06-03 14:34:10.010]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [77 data bytes]
[2023-06-03 14:34:10.010]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [77 data bytes]
[2023-06-03 14:34:10.010]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [184 data bytes]
[2023-06-03 14:34:10.010]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [15 data bytes]
[2023-06-03 14:34:10.011]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [76 data bytes]
[2023-06-03 14:34:10.011]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [57 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [127 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [45 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [45 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [66 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [33 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [75 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [44 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [98 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [123 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [45 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [51 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [37 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [76 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [77 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [77 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [77 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [77 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [15 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [90 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [70 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [56 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [76 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [77 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [77 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [77 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [77 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [15 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [47 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [62 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [187 data bytes]
[2023-06-03 14:34:10.012]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [84 data bytes]
[2023-06-03 14:34:10.014]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [112 data bytes]
[2023-06-03 14:34:10.014]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [34 data bytes]
[2023-06-03 14:34:10.014]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [45 data bytes]
[2023-06-03 14:34:10.014]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [155 data bytes]
[2023-06-03 14:34:10.014]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [38 data bytes]
[2023-06-03 14:34:10.014]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [62 data bytes]
[2023-06-03 14:34:10.014]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [187 data bytes]
[2023-06-03 14:34:10.014]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [200 data bytes]
[2023-06-03 14:34:10.014]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [188 data bytes]
[2023-06-03 14:34:10.014]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [192 data bytes]
[2023-06-03 14:34:10.014]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [36 data bytes]
[2023-06-03 14:34:10.015]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [51 data bytes]
[2023-06-03 14:34:10.015]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [23 data bytes]
[2023-06-03 14:34:10.015]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [74 data bytes]
[2023-06-03 14:34:10.015]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [51 data bytes]
[2023-06-03 14:34:10.015]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [17 data bytes]
[2023-06-03 14:34:10.015]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [23 data bytes]
[2023-06-03 14:34:10.015]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [0 data bytes]
[2023-06-03 14:34:10.015]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [6 data bytes]
[2023-06-03 14:34:10.015]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [7 data bytes]
[2023-06-03 14:34:10.015]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [8 data bytes]
[2023-06-03 14:34:10.015]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [28 data bytes]
[2023-06-03 14:34:10.016]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [15 data bytes]
[2023-06-03 14:34:10.016]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [15 data bytes]
[2023-06-03 14:34:10.016]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [16 data bytes]
[2023-06-03 14:34:10.016]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [14 data bytes]
[2023-06-03 14:34:10.016]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [21 data bytes]
[2023-06-03 14:34:10.016]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [24 data bytes]
[2023-06-03 14:34:10.016]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [24 data bytes]
[2023-06-03 14:34:10.016]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [18 data bytes]
[2023-06-03 14:34:10.016]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [18 data bytes]
[2023-06-03 14:34:10.016]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [18 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [1 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [8 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [68 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4807]: net_smtp.c:2825 handle_client: 0x7f456e7f3030 => [12 data bytes]
[2023-06-03 14:34:10.010]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [87 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [131 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [192 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [158 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [167 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [72 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [121 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [244 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [121 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [215 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [392 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [121 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [244 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [336 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [149 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [215 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [149 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [216 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [149 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [244 data bytes]
[2023-06-03 14:34:10.017]   DEBUG[4810]: net_smtp.c:2825 handle_client: 0x7f45707f7030 => [121 data bytes]
BBS server disconnected

Backtrace:

Thread 1 (Thread 0x7f459b515700 (LWP 3835)):
#0  0x00007f4580000710 in  ()
#1  0x00007f459cb0b0fa in  () at /lib/x86_64-linux-gnu/libssl.so.1.1
#2  0x00007f459cb0b203 in SSL_read () at /lib/x86_64-linux-gnu/libssl.so.1.1
#3  0x0000557d69349e83 in ssl_io_thread (unused=unused@entry=0x0) at tls.c:333
        ssl = 0x7f4580003a90
        readpipe = 61
        ores = <optimized out>
        wres = <optimized out>
        sfd = <optimized out>
        i = 11
        res = 1
        pfds = 0x7f459402dc80
        readpipes = 0x7f459401c420
        ssl_list = 0x7f459402dcf0
        prevfds = 13
        oldnumfds = <optimized out>
        numfds = 13
        numssl = <optimized out>
        needcreate = 1
        buf = "250-REDACTED at your service [127.0.0.1]\r\n172.google.com [209.85.221.172])\r\n\tby REDACTED (Postfix) with ESMTPS id 0E26B22282\r\n\tfor REDACTED; Sat,  3 Jun 2023 13:56:02 +0000"...
        pending = <optimized out>
        inovertime = 0
        overtime = 0
        needprune = <optimized out>
        err_msg = '\000' <repeats 1023 times>
        __func__ = "ssl_io_thread"
#4  0x0000557d6934874a in thread_run (data=<optimized out>) at thread.c:352
        __cancel_buf =
            {__cancel_jmp_buf = {{__cancel_jmp_buf = {139936812501792, -132307393922977715, 0, 93997147288832, 139936935270144, 93997147292448, -132307393665028019, -6172156987892682675}, __mask_was_saved = 0}}, __pad = {0x7f459b514c90, 0x0, 0x0, 0x0}}
        __cancel_routine = 0x557d69348a20 <thread_unregister>
        __cancel_arg = 0x7f459b515700
        __not_first_call = <optimized out>
        ret = <optimized out>
        a =
          {start_routine = <optimized out>, data = <optimized out>, name = 0x557d6a92f500 "ssl_io_thread         started by thread 3832 at tls.c:666 setup_ssl_io()", detached = <optimized out>, killable = <optimized out>}
#5  0x00007f459c4dcfa3 in start_thread (arg=<optimized out>) at pthread_create.c:486
        ret = <optimized out>
        pd = <optimized out>
        now = <optimized out>
        unwind_buf =
              {cancel_jmp_buf = {{jmp_buf = {139936935270144, 45816111734730829, 140724971867070, 140724971867071, 139936935270144, 93997147292448, -132307393891520435, -132296428765433779}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
#6  0x00007f459c40c06f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

valgrind backtrace:

==384202== 1 errors in context 1 of 26:
==384202== Thread 2:
==384202== Invalid read of size 4
==384202==    at 0x4A475AD: ??? (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x4A525A2: SSL_read (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x1413A3: ssl_io_thread (tls.c:333)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==  Address 0x104 is not stack'd, malloc'd or (recently) free'd
==384202==
==384202==
==384202== 1 errors in context 2 of 26:
==384202== Invalid read of size 8
==384202==    at 0x4A475A6: ??? (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x4A525A2: SSL_read (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x1413A3: ssl_io_thread (tls.c:333)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==  Address 0x10cdaec8 is 168 bytes inside a block of size 6,280 free'd
==384202==    at 0x48399AB: free (vg_replace_malloc.c:538)
==384202==    by 0x1423C6: ssl_close (tls.c:628)
==384202==    by 0xAA5B121: smtp_handler (net_smtp.c:2877)
==384202==    by 0xAA5B1D0: __smtp_handler (net_smtp.c:2893)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==  Block was alloc'd at
==384202==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==384202==    by 0x4C45349: CRYPTO_zalloc (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1)
==384202==    by 0x4A56BD4: SSL_new (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x141BC5: ssl_new_accept (tls.c:479)
==384202==    by 0xAA5AF7C: handle_client (net_smtp.c:2835)
==384202==    by 0xAA5B10A: smtp_handler (net_smtp.c:2872)
==384202==    by 0xAA5B1D0: __smtp_handler (net_smtp.c:2893)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==
==384202==
==384202== 1 errors in context 3 of 26:
==384202== Invalid read of size 8
==384202==    at 0x4A52474: ??? (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x4A525A2: SSL_read (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x1413A3: ssl_io_thread (tls.c:333)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==  Address 0x10cdae28 is 8 bytes inside a block of size 6,280 free'd
==384202==    at 0x48399AB: free (vg_replace_malloc.c:538)
==384202==    by 0x1423C6: ssl_close (tls.c:628)
==384202==    by 0xAA5B121: smtp_handler (net_smtp.c:2877)
==384202==    by 0xAA5B1D0: __smtp_handler (net_smtp.c:2893)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==  Block was alloc'd at
==384202==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==384202==    by 0x4C45349: CRYPTO_zalloc (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1)
==384202==    by 0x4A56BD4: SSL_new (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x141BC5: ssl_new_accept (tls.c:479)
==384202==    by 0xAA5AF7C: handle_client (net_smtp.c:2835)
==384202==    by 0xAA5B10A: smtp_handler (net_smtp.c:2872)
==384202==    by 0xAA5B1D0: __smtp_handler (net_smtp.c:2893)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==
==384202==
==384202== 1 errors in context 4 of 26:
==384202== Invalid read of size 1
==384202==    at 0x4A52449: ??? (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x4A525A2: SSL_read (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x1413A3: ssl_io_thread (tls.c:333)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==  Address 0x10cdb3f9 is 1,497 bytes inside a block of size 6,280 free'd
==384202==    at 0x48399AB: free (vg_replace_malloc.c:538)
==384202==    by 0x1423C6: ssl_close (tls.c:628)
==384202==    by 0xAA5B121: smtp_handler (net_smtp.c:2877)
==384202==    by 0xAA5B1D0: __smtp_handler (net_smtp.c:2893)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==  Block was alloc'd at
==384202==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==384202==    by 0x4C45349: CRYPTO_zalloc (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1)
==384202==    by 0x4A56BD4: SSL_new (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x141BC5: ssl_new_accept (tls.c:479)
==384202==    by 0xAA5AF7C: handle_client (net_smtp.c:2835)
==384202==    by 0xAA5B10A: smtp_handler (net_smtp.c:2872)
==384202==    by 0xAA5B1D0: __smtp_handler (net_smtp.c:2893)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==
==384202==
==384202== 1 errors in context 5 of 26:
==384202== Invalid read of size 4
==384202==    at 0x4A68E68: ??? (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x4A52448: ??? (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x4A525A2: SSL_read (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x1413A3: ssl_io_thread (tls.c:333)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==  Address 0x10cdaea4 is 132 bytes inside a block of size 6,280 free'd
==384202==    at 0x48399AB: free (vg_replace_malloc.c:538)
==384202==    by 0x1423C6: ssl_close (tls.c:628)
==384202==    by 0xAA5B121: smtp_handler (net_smtp.c:2877)
==384202==    by 0xAA5B1D0: __smtp_handler (net_smtp.c:2893)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==  Block was alloc'd at
==384202==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==384202==    by 0x4C45349: CRYPTO_zalloc (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1)
==384202==    by 0x4A56BD4: SSL_new (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x141BC5: ssl_new_accept (tls.c:479)
==384202==    by 0xAA5AF7C: handle_client (net_smtp.c:2835)
==384202==    by 0xAA5B10A: smtp_handler (net_smtp.c:2872)
==384202==    by 0xAA5B1D0: __smtp_handler (net_smtp.c:2893)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==
==384202==
==384202== 1 errors in context 6 of 26:
==384202== Invalid read of size 4
==384202==    at 0x4A68E15: ??? (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x4A52448: ??? (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x4A525A2: SSL_read (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x1413A3: ssl_io_thread (tls.c:333)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==  Address 0x10cdae58 is 56 bytes inside a block of size 6,280 free'd
==384202==    at 0x48399AB: free (vg_replace_malloc.c:538)
==384202==    by 0x1423C6: ssl_close (tls.c:628)
==384202==    by 0xAA5B121: smtp_handler (net_smtp.c:2877)
==384202==    by 0xAA5B1D0: __smtp_handler (net_smtp.c:2893)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==  Block was alloc'd at
==384202==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==384202==    by 0x4C45349: CRYPTO_zalloc (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1)
==384202==    by 0x4A56BD4: SSL_new (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x141BC5: ssl_new_accept (tls.c:479)
==384202==    by 0xAA5AF7C: handle_client (net_smtp.c:2835)
==384202==    by 0xAA5B10A: smtp_handler (net_smtp.c:2872)
==384202==    by 0xAA5B1D0: __smtp_handler (net_smtp.c:2893)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==
==384202==
==384202== 1 errors in context 7 of 26:
==384202== Invalid read of size 4
==384202==    at 0x4A52429: ??? (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x4A525A2: SSL_read (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x1413A3: ssl_io_thread (tls.c:333)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==  Address 0x10cdaea4 is 132 bytes inside a block of size 6,280 free'd
==384202==    at 0x48399AB: free (vg_replace_malloc.c:538)
==384202==    by 0x1423C6: ssl_close (tls.c:628)
==384202==    by 0xAA5B121: smtp_handler (net_smtp.c:2877)
==384202==    by 0xAA5B1D0: __smtp_handler (net_smtp.c:2893)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==  Block was alloc'd at
==384202==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==384202==    by 0x4C45349: CRYPTO_zalloc (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1)
==384202==    by 0x4A56BD4: SSL_new (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x141BC5: ssl_new_accept (tls.c:479)
==384202==    by 0xAA5AF7C: handle_client (net_smtp.c:2835)
==384202==    by 0xAA5B10A: smtp_handler (net_smtp.c:2872)
==384202==    by 0xAA5B1D0: __smtp_handler (net_smtp.c:2893)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==
==384202==
==384202== 1 errors in context 8 of 26:
==384202== Invalid read of size 4
==384202==    at 0x4A52418: ??? (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x4A525A2: SSL_read (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x1413A3: ssl_io_thread (tls.c:333)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==  Address 0x10cdae64 is 68 bytes inside a block of size 6,280 free'd
==384202==    at 0x48399AB: free (vg_replace_malloc.c:538)
==384202==    by 0x1423C6: ssl_close (tls.c:628)
==384202==    by 0xAA5B121: smtp_handler (net_smtp.c:2877)
==384202==    by 0xAA5B1D0: __smtp_handler (net_smtp.c:2893)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==  Block was alloc'd at
==384202==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==384202==    by 0x4C45349: CRYPTO_zalloc (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1)
==384202==    by 0x4A56BD4: SSL_new (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x141BC5: ssl_new_accept (tls.c:479)
==384202==    by 0xAA5AF7C: handle_client (net_smtp.c:2835)
==384202==    by 0xAA5B10A: smtp_handler (net_smtp.c:2872)
==384202==    by 0xAA5B1D0: __smtp_handler (net_smtp.c:2893)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==
==384202==
==384202== 1 errors in context 9 of 26:
==384202== Invalid read of size 8
==384202==    at 0x4A5240D: ??? (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x4A525A2: SSL_read (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x1413A3: ssl_io_thread (tls.c:333)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==  Address 0x10cdae50 is 48 bytes inside a block of size 6,280 free'd
==384202==    at 0x48399AB: free (vg_replace_malloc.c:538)
==384202==    by 0x1423C6: ssl_close (tls.c:628)
==384202==    by 0xAA5B121: smtp_handler (net_smtp.c:2877)
==384202==    by 0xAA5B1D0: __smtp_handler (net_smtp.c:2893)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
==384202==  Block was alloc'd at
==384202==    at 0x483877F: malloc (vg_replace_malloc.c:307)
==384202==    by 0x4C45349: CRYPTO_zalloc (in /usr/lib/x86_64-linux-gnu/libcrypto.so.1.1)
==384202==    by 0x4A56BD4: SSL_new (in /usr/lib/x86_64-linux-gnu/libssl.so.1.1)
==384202==    by 0x141BC5: ssl_new_accept (tls.c:479)
==384202==    by 0xAA5AF7C: handle_client (net_smtp.c:2835)
==384202==    by 0xAA5B10A: smtp_handler (net_smtp.c:2872)
==384202==    by 0xAA5B1D0: __smtp_handler (net_smtp.c:2893)
==384202==    by 0x1401B3: thread_run (thread.c:352)
==384202==    by 0x4EA7EA6: start_thread (pthread_create.c:477)
==384202==    by 0x4FBDA2E: clone (clone.S:95)
InterLinked1 commented 1 year ago

I suspect this issue was resolved due to stability improvements from eliminating pthread_cancel calls, or other improvements to tls.c. I haven't seen this in a while and so this seems to be resolved.