Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using TSIG with multiple threads crashes dnsperf #258

Closed
kchen opened this issue Jan 12, 2024 · 2 comments · Fixed by #259
Closed

Using TSIG with multiple threads crashes dnsperf #258

kchen opened this issue Jan 12, 2024 · 2 comments · Fixed by #259

Comments

@kchen
Copy link

kchen commented Jan 12, 2024

It appears that using TSIG with multiple threads crashes dnsperf. Using TSIG with -c 2 -T 2 (or larger numbers) triggers the issue, while not using -T does not reproduce the issue.

Here's the backtrace from gdb:

#0  0x00007fa61fc71ca8 in SHA256_Update (c=0x0, data_=0x7fa61d68f6a0, len=32)
    at include/crypto/md32_common.h:135
#1  0x00007fa61fbfd2c1 in HMAC_Final (ctx=0x7fa618001100, 
    md=md@entry=0x7fa61d68f930 "", len=len@entry=0x7fa61d68f724)
    at crypto/hmac/hmac.c:129
#2  0x00007fa61fcebf49 in hmac_final (outsize=<optimized out>, 
    outl=0x7fa61d68f798, out=0x7fa61d68f930 "", vmacctx=0x7fa618001050)
    at providers/implementations/macs/hmac_prov.c:238
#3  hmac_final (vmacctx=0x7fa618001050, out=0x7fa61d68f930 "", 
    outl=0x7fa61d68f798, outsize=<optimized out>)
    at providers/implementations/macs/hmac_prov.c:222
#4  0x00007fa61fbec0cb in evp_mac_final (ctx=0x7fa618001030, 
    xof=<optimized out>, out=0x7fa61d68f930 "", outl=0x7fa61d68f8f8, 
    outsize=64) at crypto/evp/mac_lib.c:168
#5  0x00007fa61fbeb54c in EVP_DigestSignFinal (ctx=0x5643d1d23db0, 
    sigret=sigret@entry=0x7fa61d68f930 "", siglen=siglen@entry=0x7fa61d68f8f8)
    at crypto/evp/m_sigver.c:488
#6  0x00005643d156b7f2 in perf_add_tsig (packet=packet@entry=0x7fa61d68fd20, 
    tsigkey=tsigkey@entry=0x5643d1ce48b0) at tsig.c:305
#7  0x00005643d156838b in perf_dns_buildrequest (record=<optimized out>, 
    qid=<optimized out>, edns=<optimized out>, dnssec=<optimized out>, 
    is_update=<optimized out>, tsigkey=0x5643d1ce48b0, edns_option=0x0, 
    msg=0x7fa61d68fd20) at dns.c:542
#8  0x00005643d15738a4 in do_send (arg=0x7fa61f1e71e8) at dnsperf.c:1073
#9  0x00007fa61f9e5609 in start_thread ()
   from /lib/x86_64-linux-gnu/libpthread.so.0
#10 0x00007fa61f7bb533 in clone () from /lib/x86_64-linux-gnu/libc.so.6

It looks like there's a single digest buffer per TSIG key, and probably only one perf_tsigkey_t, which likely explains the crash.

jelu added a commit to jelu/dnsperf that referenced this issue Jan 15, 2024
- `dnsperf`: Fix DNS-OARC#258: Move TSIG context to each sending thread
@jelu
Copy link
Member

jelu commented Jan 15, 2024

@kchen you're right! thanks for the report. Can you verify that #259 fixes the issue for you?

@kchen
Copy link
Author

kchen commented Jan 16, 2024

Yep, it does. Thanks!

jelu added a commit to jelu/dnsperf that referenced this issue Jan 17, 2024
- `dnsperf`: Fix DNS-OARC#258: Move TSIG context to each sending thread
@jelu jelu closed this as completed in #259 Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants