Skip to content

resolve: fix heap-use-after-free and uninitialized memory - #9572

Merged
poettering merged 2 commits into
systemd:masterfrom
yuwata:fix-9511
Jul 13, 2018
Merged

poettering merged 2 commits into
systemd:masterfrom
yuwata:fix-9511

Conversation

@yuwata

@yuwata yuwata commented Jul 12, 2018

Copy link
Copy Markdown
Member

Fixes #9511.

cc @evverx and @irtimmer.

yuwata added 2 commits July 12, 2018 12:57
This fixes the following valgrind warning:
```
Syscall param sendmsg(msg.msg_name) points to uninitialised byte(s)
   at 0x6189CC1: sendmsg (in /usr/lib64/libpthread-2.27.so)
   by 0x153082: dns_stream_writev (resolved-dns-stream.c:235)
   by 0x153343: dns_stream_tls_writev (resolved-dns-stream.c:299)
   by 0x5B30343: ??? (in /usr/lib64/libgnutls.so.30.20.2)
   by 0x5B3158F: ??? (in /usr/lib64/libgnutls.so.30.20.2)
   by 0x5B33190: ??? (in /usr/lib64/libgnutls.so.30.20.2)
   by 0x5B36307: ??? (in /usr/lib64/libgnutls.so.30.20.2)
   by 0x5B37D47: gnutls_handshake (in /usr/lib64/libgnutls.so.30.20.2)
   by 0x154591: dns_stream_connect_tls (resolved-dns-stream.c:596)
   by 0x13A889: dns_transaction_emit_tcp (resolved-dns-transaction.c:676)
   by 0x13D901: dns_transaction_go (resolved-dns-transaction.c:1761)
   by 0x1330C8: dns_query_candidate_go (resolved-dns-query.c:156)
 Address 0xa9ac268 is 312 bytes inside a block of size 592 alloc'd
   at 0x4C30B06: calloc (vg_replace_malloc.c:711)
   by 0x1541F8: dns_stream_new (resolved-dns-stream.c:545)
   by 0x13A662: dns_transaction_emit_tcp (resolved-dns-transaction.c:642)
   by 0x13D901: dns_transaction_go (resolved-dns-transaction.c:1761)
   by 0x1330C8: dns_query_candidate_go (resolved-dns-query.c:156)
   by 0x134E16: dns_query_go (resolved-dns-query.c:757)
   by 0x11F3FB: bus_method_resolve_hostname (resolved-bus.c:353)
   by 0x4F947A7: method_callbacks_run (bus-objects.c:402)
   by 0x4F97266: object_find_and_run (bus-objects.c:1260)
   by 0x4F978B1: bus_process_object (bus-objects.c:1376)
   by 0x4FAF82C: process_message (sd-bus.c:2661)
   by 0x4FAFA1B: process_running (sd-bus.c:2703)
```
@yuwata yuwata added the resolve label Jul 12, 2018
@poettering
poettering merged commit 5901d89 into systemd:master Jul 13, 2018
@evverx

evverx commented Jul 14, 2018

Copy link
Copy Markdown
Contributor

@yuwata thank you! Just out of curiosity, what version of valgrind are you using? As far as I can remember, when I last tried to run anything related to systemd under valgrind, it complained about an unimplemented syscall, which I was too lazy to add :-). It appears to have been fixed in more recent versions.

@yuwata
yuwata deleted the fix-9511 branch July 14, 2018 02:34
@yuwata

yuwata commented Jul 15, 2018

Copy link
Copy Markdown
Member Author

I've investigated this with

  • valgrind-3.13.0-20.fc28.x86_64
  • gnutls-3.6.2-3.fc28.x86_64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants