Ondřej Surý
98def35e72
Handle the errors from sysconf() call in isc_meminfo_totalphys()
...
isc_meminfo_totalphys() would return invalid memory size when sysconf()
call would fail, because ((size_t)-1 * -1) is very large number.
(cherry picked from commit 79ca724d46 )
2020-09-21 10:59:36 +02:00
Ondřej Surý
fe738c7432
Exclude isc_mem_isovermem from ThreadSanitizer
...
The .is_overmem member of isc_mem_t structure is intentionally accessed
unlocked as 100% accuracy isn't necessary here.
Without the attribute, following TSAN warning would show up:
WARNING: ThreadSanitizer: data race
Write of size 1 at 0x000000000001 by thread T1 (mutexes: write M1, write M2):
#0 isc___mem_put lib/isc/mem.c:1119:19
#1 isc__mem_put lib/isc/mem.c:2439:2
#2 dns_rdataslab_fromrdataset lib/dns/rdataslab.c:327:2
#3 addrdataset lib/dns/rbtdb.c:6761:11
#4 dns_db_addrdataset lib/dns/db.c:719:10
#5 cache_name lib/dns/resolver.c:6538:13
#6 cache_message lib/dns/resolver.c:6628:14
#7 resquery_response lib/dns/resolver.c:7883:13
#8 dispatch lib/isc/task.c:1152:7
#9 run lib/isc/task.c:1344:2
Previous read of size 1 at 0x000000000001 by thread T2 (mutexes: write M3):
#0 isc_mem_isovermem lib/isc/mem.c:1553:15
#1 addrdataset lib/dns/rbtdb.c:6866:25
#2 dns_db_addrdataset lib/dns/db.c:719:10
#3 addoptout lib/dns/ncache.c:281:10
#4 dns_ncache_add lib/dns/ncache.c:101:10
#5 ncache_adderesult lib/dns/resolver.c:6668:12
#6 ncache_message lib/dns/resolver.c:6845:11
#7 rctx_ncache lib/dns/resolver.c:9174:11
#8 resquery_response lib/dns/resolver.c:7894:2
#9 dispatch lib/isc/task.c:1152:7
#10 run lib/isc/task.c:1344:2
Location is heap block of size 328 at 0x000000000020 allocated by thread T3:
#0 malloc <null>
#1 default_memalloc lib/isc/mem.c:713:8
#2 mem_create lib/isc/mem.c:763:8
#3 isc_mem_create lib/isc/mem.c:2425:2
#4 configure_view bin/named/server.c:4494:4
#5 load_configuration bin/named/server.c:9062:3
#6 run_server bin/named/server.c:9771:2
#7 dispatch lib/isc/task.c:1152:7
#8 run lib/isc/task.c:1344:2
[...]
SUMMARY: ThreadSanitizer: data race lib/isc/mem.c:1119:19 in isc___mem_put
(cherry picked from commit 0110d1ab17 )
2020-09-17 17:39:03 +02:00
Tinderbox User and Michał Kępień
e7b0d5de15
prep 9.11.23
2020-09-16 23:00:15 +02:00
Evan Hunt
400171aee8
update all copyright headers to eliminate the typo
2020-09-14 17:00:40 -07:00
Mark Andrews
87e8497b6a
Silence REVERSE_INULL warning (CID 306652)
...
(cherry picked from commit 584dbffab1 )
2020-09-10 07:57:20 +10:00
Mark Andrews
1d0c1e62b4
Silence Coverity missing lock warning.
...
Lock access to 'done' during initialisation in manytasks().
2020-09-09 21:02:51 +00:00
Mark Andrews
1f7a4f9ab2
Turn off TSAN for isc_log_wouldlog
2020-09-08 17:41:33 +10:00
Mark Andrews
d6c727d669
ISC_QUEUE_POP is not tsan safe. Suppress warnings
...
ret->link.next is tested to see if it is NULL unlocked
to avoid obtaining taillock when it is not nexessary then
retested once the taillock is obtained.
2020-09-08 17:41:33 +10:00
Mark Andrews
72cbe648c4
Test if linked while holding the queue lock
...
WARNING: ThreadSanitizer: data race
Read of size 8 at 0x000000000001 by thread T1:
#0 client_shutdown bin/named/client.c:849:6
#1 dispatch lib/isc/task.c:1157:7
#2 run lib/isc/task.c:1331:2
Previous write of size 8 at 0x000000000001 by thread T2 (mutexes: write M1, write M2):
#0 client_shutdown bin/named/client.c:850:3
#1 dispatch lib/isc/task.c:1157:7
#2 run lib/isc/task.c:1331:2
2020-09-08 09:25:43 +10:00
Mark Andrews
fb8a3c9ab2
Remove optimisation on obtaining a headlock as it triggers a tsan.
...
WARNING: ThreadSanitizer: data race (pid=15898)
Write of size 8 at 0x7b6400011818 by thread T9 (mutexes: write M1597):
#0 get_client /builds/isc-projects/bind9/bin/named/client.c:3876:3 (named+0x4db171)
#1 ns_client_replace /builds/isc-projects/bind9/bin/named/client.c:3710:12 (named+0x4d737b)
#2 query_recurse /builds/isc-projects/bind9/bin/named/query.c:4325:13 (named+0x4ff469)
#3 query_find /builds/isc-projects/bind9/bin/named/query.c (named+0x4fb949)
#4 ns_query_start /builds/isc-projects/bind9/bin/named/query.c:9675:8 (named+0x4f37cb)
#5 client_request /builds/isc-projects/bind9/bin/named/client.c:3112:3 (named+0x4de9ef)
#6 dispatch /builds/isc-projects/bind9/lib/isc/task.c:1157:7 (libisc.so.1107+0x50845)
#7 run /builds/isc-projects/bind9/lib/isc/task.c:1331:2 (libisc.so.1107+0x4d799)
Previous read of size 8 at 0x7b6400011818 by thread T2:
#0 exit_check /builds/isc-projects/bind9/bin/named/client.c:698:5 (named+0x4d5d22)
#1 ns_client_detach /builds/isc-projects/bind9/bin/named/client.c:3687:8 (named+0x4d7762)
#2 query_find /builds/isc-projects/bind9/bin/named/query.c (named+0x4f9021)
#3 query_resume /builds/isc-projects/bind9/bin/named/query.c:4164:12 (named+0x509b68)
#4 dispatch /builds/isc-projects/bind9/lib/isc/task.c:1157:7 (libisc.so.1107+0x50845)
#5 run /builds/isc-projects/bind9/lib/isc/task.c:1331:2 (libisc.so.1107+0x4d799)
2020-09-08 09:25:43 +10:00
Mark Andrews
15ae4585d2
counter->used was read without the lock being held.
...
WARNING: ThreadSanitizer: data race (pid=11785)
Write of size 4 at 0x7b180001ba10 by thread T12 (mutexes: write M835834548863482336):
#0 isc_counter_increment /builds/isc-projects/bind9/lib/isc/counter.c:70:15 (libisc.so.1107+0x1dcb6)
#1 fctx_try /builds/isc-projects/bind9/lib/dns/resolver.c:3851:11 (libdns.so.1110+0x17e312)
#2 resume_dslookup /builds/isc-projects/bind9/lib/dns/resolver.c:7505:3 (libdns.so.1110+0x18ccf0)
#3 dispatch /builds/isc-projects/bind9/lib/isc/task.c:1157:7 (libisc.so.1107+0x507f5)
#4 run /builds/isc-projects/bind9/lib/isc/task.c:1331:2 (libisc.so.1107+0x4d749)
Previous read of size 4 at 0x7b180001ba10 by thread T7:
#0 isc_counter_used /builds/isc-projects/bind9/lib/isc/counter.c:82:19 (libisc.so.1107+0x1dd5f)
#1 fctx_try /builds/isc-projects/bind9/lib/dns/resolver.c:3798:6 (libdns.so.1110+0x17e0d1)
#2 fctx_start /builds/isc-projects/bind9/lib/dns/resolver.c:4219:4 (libdns.so.1110+0x178833)
#3 dispatch /builds/isc-projects/bind9/lib/isc/task.c:1157:7 (libisc.so.1107+0x507f5)
#4 run /builds/isc-projects/bind9/lib/isc/task.c:1331:2 (libisc.so.1107+0x4d749)
2020-09-08 09:25:43 +10:00
Mark Andrews
cf4a9d9ab8
It appears that you can't change what you are polling for while connecting.
...
WARNING: ThreadSanitizer: data race (pid=6465)
Read of size 8 at 0x7ba000002040 by thread T14:
#0 epoll_ctl <null> (named+0x44ccd2)
#1 watch_fd /builds/isc-projects/bind9/lib/isc/unix/socket.c:975:8 (libisc.so.1107+0x6bd90)
#2 wakeup_socket /builds/isc-projects/bind9/lib/isc/unix/socket.c:1164:11 (libisc.so.1107+0x7057d)
#3 process_ctlfd /builds/isc-projects/bind9/lib/isc/unix/socket.c:4258:3 (libisc.so.1107+0x6c308)
#4 process_fds /builds/isc-projects/bind9/lib/isc/unix/socket.c:4162:10 (libisc.so.1107+0x6bf74)
#5 watcher /builds/isc-projects/bind9/lib/isc/unix/socket.c:4401:10 (libisc.so.1107+0x64348)
Previous write of size 8 at 0x7ba000002040 by thread T9 (mutexes: write M81481868977181736):
#0 connect <null> (named+0x44b7e0)
#1 isc__socket_connect /builds/isc-projects/bind9/lib/isc/unix/socket.c:5902:7 (libisc.so.1107+0x67a79)
#2 isc_socket_connect /builds/isc-projects/bind9/lib/isc/unix/./../socket_api.c:169:11 (libisc.so.1107+0x6aa4b)
#3 resquery_send /builds/isc-projects/bind9/lib/dns/resolver.c:2573:13 (libdns.so.1110+0x18570b)
#4 fctx_query /builds/isc-projects/bind9/lib/dns/resolver.c:1903:12 (libdns.so.1110+0x1815a3)
#5 fctx_try /builds/isc-projects/bind9/lib/dns/resolver.c:3863:11 (libdns.so.1110+0x17e3a9)
#6 fctx_start /builds/isc-projects/bind9/lib/dns/resolver.c:4219:4 (libdns.so.1110+0x178833)
#7 dispatch /builds/isc-projects/bind9/lib/isc/task.c:1157:7 (libisc.so.1107+0x507f5)
#8 run /builds/isc-projects/bind9/lib/isc/task.c:1331:2 (libisc.so.1107+0x4d749)
Location is file descriptor 516 created by thread T9 at:
#0 connect <null> (named+0x44b7e0)
#1 isc__socket_connect /builds/isc-projects/bind9/lib/isc/unix/socket.c:5902:7 (libisc.so.1107+0x67a79)
#2 isc_socket_connect /builds/isc-projects/bind9/lib/isc/unix/./../socket_api.c:169:11 (libisc.so.1107+0x6aa4b)
#3 resquery_send /builds/isc-projects/bind9/lib/dns/resolver.c:2573:13 (libdns.so.1110+0x18570b)
#4 fctx_query /builds/isc-projects/bind9/lib/dns/resolver.c:1903:12 (libdns.so.1110+0x1815a3)
#5 fctx_try /builds/isc-projects/bind9/lib/dns/resolver.c:3863:11 (libdns.so.1110+0x17e3a9)
#6 fctx_start /builds/isc-projects/bind9/lib/dns/resolver.c:4219:4 (libdns.so.1110+0x178833)
#7 dispatch /builds/isc-projects/bind9/lib/isc/task.c:1157:7 (libisc.so.1107+0x507f5)
#8 run /builds/isc-projects/bind9/lib/isc/task.c:1331:2 (libisc.so.1107+0x4d749)
2020-09-08 09:25:43 +10:00
Mark Andrews
bf0bac4068
isc_refcount_current should be memory_order_acquire
2020-09-08 09:25:43 +10:00
Mark Andrews
52a715b122
isc_mutex_init_errcheck prototype should not be under ISC_MUTEX_PROFILE
2020-09-08 09:25:43 +10:00
Mark Andrews
16e7e27328
Address data races between socket bitfields
...
* address data race between sock->pending_recv and sock->connected
* address data race between sock->bound and sock->pending_recv
==================
WARNING: ThreadSanitizer: data race (pid=1985)
Read of size 2 at 0x7b54000c07c0 by thread T6:
#0 isc__socket_sendto /builds/isc-projects/bind9/lib/isc/unix/socket.c:5291:2 (libisc.so.1107+0x65a00)
#1 isc__socket_send /builds/isc-projects/bind9/lib/isc/unix/socket.c:5270:10 (libisc.so.1107+0x65944)
#2 isc_socket_send /builds/isc-projects/bind9/lib/isc/unix/./../socket_api.c:329:10 (libisc.so.1107+0x6b3c9)
#3 sendstream /builds/isc-projects/bind9/bin/named/xfrout.c:1548:3 (named+0x555038)
#4 ns_xfr_start /builds/isc-projects/bind9/bin/named/xfrout.c:1132:2 (named+0x553147)
#5 ns_query_start /builds/isc-projects/bind9/bin/named/query.c:9572:4 (named+0x4f3329)
#6 client_request /builds/isc-projects/bind9/bin/named/client.c:3115:3 (named+0x4de6af)
#7 dispatch /builds/isc-projects/bind9/lib/isc/task.c:1157:7 (libisc.so.1107+0x50845)
#8 run /builds/isc-projects/bind9/lib/isc/task.c:1331:2 (libisc.so.1107+0x4d799)
Previous write of size 2 at 0x7b54000c07c0 by thread T14 (mutexes: write M57, write M855819529908651432):
#0 dispatch_recv /builds/isc-projects/bind9/lib/isc/unix/socket.c:3353:21 (libisc.so.1107+0x6c601)
#1 process_fd /builds/isc-projects/bind9/lib/isc/unix/socket.c:4048:5 (libisc.so.1107+0x6c1be)
#2 process_fds /builds/isc-projects/bind9/lib/isc/unix/socket.c:4161:3 (libisc.so.1107+0x6bfc0)
#3 watcher /builds/isc-projects/bind9/lib/isc/unix/socket.c:4407:10 (libisc.so.1107+0x64398)
2020-09-08 09:25:43 +10:00
Mark Andrews
bcfbc17384
Lock access to ctx->blocked as it is updated by multiple threads
2020-09-08 09:25:43 +10:00
Mark Andrews
5cc2806cea
Add locking to address tsan errors.
...
Address data races with 'a', 'b', 'c', 'd', 'e', 'counter', 'done',
'nevents', 'nsdevents', 'all_done', and 'eventcnt'.
Add isc_mutex_init/isc_mutex_destroy.
2020-09-02 08:43:42 +00:00
Mark Andrews
9b66341971
Lock access when updating/reading manager->epoll_events[fd]
...
WARNING: ThreadSanitizer: data race (pid=110)
Write of size 4 at 0x7ba400014050 by main thread (mutexes: write M1100, write M75):
#0 socket_create /builds/isc-projects/bind9/lib/isc/unix/socket.c:3012:34 (libisc.so.1105+0x6085c)
#1 isc__socket_create /builds/isc-projects/bind9/lib/isc/unix/socket.c:3044:10 (libisc.so.1105+0x60583)
#2 isc_socket_create /builds/isc-projects/bind9/lib/isc/unix/./../socket_api.c:105:11 (libisc.so.1105+0x6a4a0)
#3 open_socket /builds/isc-projects/bind9/lib/dns/dispatch.c:1708:12 (libdns.so.1110+0x7491c)
#4 get_udpsocket /builds/isc-projects/bind9/lib/dns/dispatch.c:2904:13 (libdns.so.1110+0x745ec)
#5 dispatch_createudp /builds/isc-projects/bind9/lib/dns/dispatch.c:2994:12 (libdns.so.1110+0x6e159)
#6 dns_dispatch_getudp_dup /builds/isc-projects/bind9/lib/dns/dispatch.c:2823:11 (libdns.so.1110+0x6d8f2)
#7 dns_dispatch_getudp /builds/isc-projects/bind9/lib/dns/dispatch.c:2849:10 (libdns.so.1110+0x6e99e)
#8 make_dispatchset /builds/isc-projects/bind9/lib/dns/tests/dispatch_test.c:81:11 (dispatch_test+0x4ba8fc)
#9 dispatchset_create /builds/isc-projects/bind9/lib/dns/tests/dispatch_test.c:115:11 (dispatch_test+0x4b9f99)
#10 <null> <null> (libcmocka.so.0+0x50d8)
#11 __libc_start_main /build/glibc-vjB4T1/glibc-2.28/csu/../csu/libc-start.c:308:16 (libc.so.6+0x2409a)
Previous write of size 4 at 0x7ba400014050 by thread T14:
#0 unwatch_fd /builds/isc-projects/bind9/lib/isc/unix/socket.c (libisc.so.1105+0x6b913)
#1 wakeup_socket /builds/isc-projects/bind9/lib/isc/unix/socket.c:1128:9 (libisc.so.1105+0x701fc)
#2 process_ctlfd /builds/isc-projects/bind9/lib/isc/unix/socket.c:4253:3 (libisc.so.1105+0x6c048)
#3 process_fds /builds/isc-projects/bind9/lib/isc/unix/socket.c:4157:10 (libisc.so.1105+0x6bcb4)
#4 watcher /builds/isc-projects/bind9/lib/isc/unix/socket.c:4396:10 (libisc.so.1105+0x64188)
Location is heap block of size 16385 at 0x7ba400014000 allocated by main thread:
#0 malloc <null> (dispatch_test+0x42b7c4)
#1 internal_memalloc /builds/isc-projects/bind9/lib/isc/mem.c:887:8 (libisc.so.1105+0x37e38)
#2 mem_get /builds/isc-projects/bind9/lib/isc/mem.c:792:8 (libisc.so.1105+0x32c2c)
#3 isc___mem_get /builds/isc-projects/bind9/lib/isc/mem.c:1310:9 (libisc.so.1105+0x325d7)
#4 isc__mem_get /builds/isc-projects/bind9/lib/isc/mem.c:3012:11 (libisc.so.1105+0x34f80)
#5 isc__socketmgr_create2 /builds/isc-projects/bind9/lib/isc/unix/socket.c:4704:26 (libisc.so.1105+0x6379a)
#6 isc__socketmgr_create /builds/isc-projects/bind9/lib/isc/unix/socket.c:4652:10 (libisc.so.1105+0x635f2)
#7 isc_socketmgr_create /builds/isc-projects/bind9/lib/isc/unix/./../socket_api.c:74:11 (libisc.so.1105+0x6a2c7)
#8 create_managers /builds/isc-projects/bind9/lib/dns/tests/dnstest.c:120:2 (dispatch_test+0x4bb28a)
#9 dns_test_begin /builds/isc-projects/bind9/lib/dns/tests/dnstest.c:192:3 (dispatch_test+0x4bb182)
#10 _setup /builds/isc-projects/bind9/lib/dns/tests/dispatch_test.c:53:11 (dispatch_test+0x4b9ff8)
#11 <null> <null> (libcmocka.so.0+0x51e2)
#12 __libc_start_main /build/glibc-vjB4T1/glibc-2.28/csu/../csu/libc-start.c:308:16 (libc.so.6+0x2409a)
Mutex M1100 (0x7b5000000230) created at:
#0 pthread_mutex_init <null> (dispatch_test+0x42e60d)
#1 isc__mutex_init /builds/isc-projects/bind9/lib/isc/pthreads/mutex.c:287:8 (libisc.so.1105+0x72377)
#2 dns_dispatchmgr_create /builds/isc-projects/bind9/lib/dns/dispatch.c:1778:11 (libdns.so.1110+0x6a055)
#3 make_dispatchset /builds/isc-projects/bind9/lib/dns/tests/dispatch_test.c:75:11 (dispatch_test+0x4ba883)
#4 dispatchset_create /builds/isc-projects/bind9/lib/dns/tests/dispatch_test.c:115:11 (dispatch_test+0x4b9f99)
#5 <null> <null> (libcmocka.so.0+0x50d8)
#6 __libc_start_main /build/glibc-vjB4T1/glibc-2.28/csu/../csu/libc-start.c:308:16 (libc.so.6+0x2409a)
Mutex M75 (0x7bb800000320) created at:
#0 pthread_mutex_init <null> (dispatch_test+0x42e60d)
#1 isc__mutex_init /builds/isc-projects/bind9/lib/isc/pthreads/mutex.c:287:8 (libisc.so.1105+0x72377)
#2 isc__socketmgr_create2 /builds/isc-projects/bind9/lib/isc/unix/socket.c:4729:12 (libisc.so.1105+0x63914)
#3 isc__socketmgr_create /builds/isc-projects/bind9/lib/isc/unix/socket.c:4652:10 (libisc.so.1105+0x635f2)
#4 isc_socketmgr_create /builds/isc-projects/bind9/lib/isc/unix/./../socket_api.c:74:11 (libisc.so.1105+0x6a2c7)
#5 create_managers /builds/isc-projects/bind9/lib/dns/tests/dnstest.c:120:2 (dispatch_test+0x4bb28a)
#6 dns_test_begin /builds/isc-projects/bind9/lib/dns/tests/dnstest.c:192:3 (dispatch_test+0x4bb182)
#7 _setup /builds/isc-projects/bind9/lib/dns/tests/dispatch_test.c:53:11 (dispatch_test+0x4b9ff8)
#8 <null> <null> (libcmocka.so.0+0x51e2)
#9 __libc_start_main /build/glibc-vjB4T1/glibc-2.28/csu/../csu/libc-start.c:308:16 (libc.so.6+0x2409a)
Thread T14 'isc-socket' (tid=150, running) created by main thread at:
#0 pthread_create <null> (dispatch_test+0x42d08b)
#1 isc_thread_create /builds/isc-projects/bind9/lib/isc/pthreads/thread.c:60:8 (libisc.so.1105+0x724e8)
#2 isc__socketmgr_create2 /builds/isc-projects/bind9/lib/isc/unix/socket.c:4788:6 (libisc.so.1105+0x63cc6)
#3 isc__socketmgr_create /builds/isc-projects/bind9/lib/isc/unix/socket.c:4652:10 (libisc.so.1105+0x635f2)
#4 isc_socketmgr_create /builds/isc-projects/bind9/lib/isc/unix/./../socket_api.c:74:11 (libisc.so.1105+0x6a2c7)
#5 create_managers /builds/isc-projects/bind9/lib/dns/tests/dnstest.c:120:2 (dispatch_test+0x4bb28a)
#6 dns_test_begin /builds/isc-projects/bind9/lib/dns/tests/dnstest.c:192:3 (dispatch_test+0x4bb182)
#7 _setup /builds/isc-projects/bind9/lib/dns/tests/dispatch_test.c:53:11 (dispatch_test+0x4b9ff8)
#8 <null> <null> (libcmocka.so.0+0x51e2)
#9 __libc_start_main /build/glibc-vjB4T1/glibc-2.28/csu/../csu/libc-start.c:308:16 (libc.so.6+0x2409a)
SUMMARY: ThreadSanitizer: data race /builds/isc-projects/bind9/lib/isc/unix/socket.c:3012:34 in socket_create
2020-09-02 03:07:03 +00:00
Mark Andrews
d9a2cccc97
Lock on msg == SELECT_POKE_CLOSE as it triggers a tsan error
...
WARNING: ThreadSanitizer: data race (pid=1941)
Write of size 4 at 0x7ba40000f050 by main thread (mutexes: write M1100, write M75):
#0 socket_create /builds/isc-projects/bind9/1126G:3009:29 (libisc.so.1105+0x60822)
#1 isc__socket_create /builds/isc-projects/bind9/lib/isc/unix/socket.c:3043:10 (libisc.so.1105+0x60583)
#2 isc_socket_create /builds/isc-projects/bind9/lib/isc/unix/./../socket_api.c:105:11 (libisc.so.1105+0x6a4a0)
#3 open_socket /builds/isc-projects/bind9/lib/dns/dispatch.c:1708:12 (libdns.so.1110+0x7491c)
#4 get_udpsocket /builds/isc-projects/bind9/lib/dns/dispatch.c:2904:13 (libdns.so.1110+0x745ec)
#5 dispatch_createudp /builds/isc-projects/bind9/lib/dns/dispatch.c:2994:12 (libdns.so.1110+0x6e159)
#6 dns_dispatch_getudp_dup /builds/isc-projects/bind9/lib/dns/dispatch.c:2823:11 (libdns.so.1110+0x6d8f2)
#7 dns_dispatch_getudp /builds/isc-projects/bind9/lib/dns/dispatch.c:2849:10 (libdns.so.1110+0x6e99e)
#8 make_dispatchset /builds/isc-projects/bind9/lib/dns/tests/dispatch_test.c:81:11 (dispatch_test+0x4ba8fc)
#9 dispatchset_create /builds/isc-projects/bind9/lib/dns/tests/dispatch_test.c:115:11 (dispatch_test+0x4b9f99)
#10 <null> <null> (libcmocka.so.0+0x50d8)
#11 __libc_start_main /build/glibc-vjB4T1/glibc-2.28/csu/../csu/libc-start.c:308:16 (libc.so.6+0x2409a)
Previous write of size 4 at 0x7ba40000f050 by thread T14:
#0 wakeup_socket /builds/isc-projects/bind9/lib/isc/unix/socket.c:1126:24 (libisc.so.1105+0x70181)
#1 process_ctlfd /builds/isc-projects/bind9/lib/isc/unix/socket.c:4252:3 (libisc.so.1105+0x6c048)
#2 process_fds /builds/isc-projects/bind9/lib/isc/unix/socket.c:4156:10 (libisc.so.1105+0x6bcb4)
#3 watcher /builds/isc-projects/bind9/lib/isc/unix/socket.c:4395:10 (libisc.so.1105+0x64188)
Location is heap block of size 16385 at 0x7ba40000f000 allocated by main thread:
#0 malloc <null> (dispatch_test+0x42b7c4)
#1 internal_memalloc /builds/isc-projects/bind9/lib/isc/mem.c:887:8 (libisc.so.1105+0x37e38)
#2 mem_get /builds/isc-projects/bind9/lib/isc/mem.c:792:8 (libisc.so.1105+0x32c2c)
#3 isc___mem_get /builds/isc-projects/bind9/lib/isc/mem.c:1310:9 (libisc.so.1105+0x325d7)
#4 isc__mem_get /builds/isc-projects/bind9/lib/isc/mem.c:3012:11 (libisc.so.1105+0x34f80)
#5 isc__socketmgr_create2 /builds/isc-projects/bind9/lib/isc/unix/socket.c:4697:21 (libisc.so.1105+0x6374f)
#6 isc__socketmgr_create /builds/isc-projects/bind9/lib/isc/unix/socket.c:4651:10 (libisc.so.1105+0x635f2)
#7 isc_socketmgr_create /builds/isc-projects/bind9/lib/isc/unix/./../socket_api.c:74:11 (libisc.so.1105+0x6a2c7)
#8 create_managers /builds/isc-projects/bind9/lib/dns/tests/dnstest.c:120:2 (dispatch_test+0x4bb28a)
#9 dns_test_begin /builds/isc-projects/bind9/lib/dns/tests/dnstest.c:192:3 (dispatch_test+0x4bb182)
#10 _setup /builds/isc-projects/bind9/lib/dns/tests/dispatch_test.c:53:11 (dispatch_test+0x4b9ff8)
#11 <null> <null> (libcmocka.so.0+0x51e2)
#12 __libc_start_main /build/glibc-vjB4T1/glibc-2.28/csu/../csu/libc-start.c:308:16 (libc.so.6+0x2409a)
Mutex M1100 (0x7b5000000230) created at:
#0 pthread_mutex_init <null> (dispatch_test+0x42e60d)
#1 isc__mutex_init /builds/isc-projects/bind9/lib/isc/pthreads/mutex.c:287:8 (libisc.so.1105+0x72317)
#2 dns_dispatchmgr_create /builds/isc-projects/bind9/lib/dns/dispatch.c:1778:11 (libdns.so.1110+0x6a055)
#3 make_dispatchset /builds/isc-projects/bind9/lib/dns/tests/dispatch_test.c:75:11 (dispatch_test+0x4ba883)
#4 dispatchset_create /builds/isc-projects/bind9/lib/dns/tests/dispatch_test.c:115:11 (dispatch_test+0x4b9f99)
#5 <null> <null> (libcmocka.so.0+0x50d8)
#6 __libc_start_main /build/glibc-vjB4T1/glibc-2.28/csu/../csu/libc-start.c:308:16 (libc.so.6+0x2409a)
Mutex M75 (0x7bb800000320) created at:
#0 pthread_mutex_init <null> (dispatch_test+0x42e60d)
#1 isc__mutex_init /builds/isc-projects/bind9/lib/isc/pthreads/mutex.c:287:8 (libisc.so.1105+0x72317)
#2 isc__socketmgr_create2 /builds/isc-projects/bind9/lib/isc/unix/socket.c:4728:12 (libisc.so.1105+0x63914)
#3 isc__socketmgr_create /builds/isc-projects/bind9/lib/isc/unix/socket.c:4651:10 (libisc.so.1105+0x635f2)
#4 isc_socketmgr_create /builds/isc-projects/bind9/lib/isc/unix/./../socket_api.c:74:11 (libisc.so.1105+0x6a2c7)
#5 create_managers /builds/isc-projects/bind9/lib/dns/tests/dnstest.c:120:2 (dispatch_test+0x4bb28a)
#6 dns_test_begin /builds/isc-projects/bind9/lib/dns/tests/dnstest.c:192:3 (dispatch_test+0x4bb182)
#7 _setup /builds/isc-projects/bind9/lib/dns/tests/dispatch_test.c:53:11 (dispatch_test+0x4b9ff8)
#8 <null> <null> (libcmocka.so.0+0x51e2)
#9 __libc_start_main /build/glibc-vjB4T1/glibc-2.28/csu/../csu/libc-start.c:308:16 (libc.so.6+0x2409a)
Thread T14 'isc-socket' (tid=1969, running) created by main thread at:
#0 pthread_create <null> (dispatch_test+0x42d08b)
#1 isc_thread_create /builds/isc-projects/bind9/lib/isc/pthreads/thread.c:60:8 (libisc.so.1105+0x72488)
#2 isc__socketmgr_create2 /builds/isc-projects/bind9/lib/isc/unix/socket.c:4787:6 (libisc.so.1105+0x63cc6)
#3 isc__socketmgr_create /builds/isc-projects/bind9/lib/isc/unix/socket.c:4651:10 (libisc.so.1105+0x635f2)
#4 isc_socketmgr_create /builds/isc-projects/bind9/lib/isc/unix/./../socket_api.c:74:11 (libisc.so.1105+0x6a2c7)
#5 create_managers /builds/isc-projects/bind9/lib/dns/tests/dnstest.c:120:2 (dispatch_test+0x4bb28a)
#6 dns_test_begin /builds/isc-projects/bind9/lib/dns/tests/dnstest.c:192:3 (dispatch_test+0x4bb182)
#7 _setup /builds/isc-projects/bind9/lib/dns/tests/dispatch_test.c:53:11 (dispatch_test+0x4b9ff8)
#8 <null> <null> (libcmocka.so.0+0x51e2)
#9 __libc_start_main /build/glibc-vjB4T1/glibc-2.28/csu/../csu/libc-start.c:308:16 (libc.so.6+0x2409a)
SUMMARY: ThreadSanitizer: data race /builds/isc-projects/bind9/lib/isc/unix/socket.c:3009:29 in socket_create
2020-09-02 03:07:03 +00:00
Mark Andrews
a7da8f84ca
isc_ratelimiter needs to hold a reference to its task
...
to prevent the task subsystem shutting down before the
ratelimiter is freed.
(cherry picked from commit b8e4b6d303 )
2020-09-02 11:47:37 +10:00
Mark Andrews
310004d8ac
Add locking to socket_test to silence tsan reports.
...
There where data races accessing completion.
2020-09-02 00:25:56 +00:00
Mark Andrews
8094b821b3
Lock access to 'eventcnt' in timer_test.
...
There was a data race accessing 'eventcnt'.
2020-09-01 22:15:23 +00:00
Mark Andrews
30013c3794
Use memory_order_acq_rel in isc_refcount_decrement.
...
While
if (isc_refcount_decrement() == 1) { // memory_order_release
isc_refcount_destroy(); // memory_order_acquire
...
}
is theoretically the most efficent in practice, using
memory_order_acq_rel produces the same code on x86_64 and doesn't
trigger tsan data races (which use a idealistic model) if
isc_refcount_destroy() is not called immediately. In fact
isc_refcount_destroy() could be removed if we didn't want
to check for the count being 0 when isc_refcount_destroy() is
called.
https://stackoverflow.com/questions/49112732/memory-order-in-shared-pointer-destructor
(cherry picked from commit 6278899a38 )
2020-09-01 22:31:52 +10:00
Michal Nowak
966eb72f5b
Fix warnings in when build with --enable-buffer-useinline
...
sockaddr.c:147:49: error: pointer targets in passing argument 2 of ‘isc__buffer_putmem’ differ in signedness
rdata.c:1780:30: error: pointer targets in passing argument 2 of ‘isc__buffer_putmem’ differ in signedness
(cherry picked from commit dd425254a7 )
2020-08-25 16:13:54 +02:00
Evan Hunt
15d57a425e
Merge tag 'v9_11_22' into v9_11
...
BIND 9.11.22
2020-08-20 12:10:47 -07:00
Mark Andrews
af4dd77a44
base32_decode*() could incorrectly decode a input.
...
base32_decode_char() added a extra zero octet to the output
if the fifth character was a pad character. The length
of octets to copy to the output was set to 3 instead of 2.
(cherry picked from commit 6c7e50c267 )
2020-08-14 00:16:45 +10:00
Tinderbox User
7427b1f31c
prep 9.11.22
2020-08-06 10:05:20 +00:00
Ondřej Surý and Michał Kępień
8d807cc216
Fix crash in pk11_numbits() when native-pkcs11 is used
...
When pk11_numbits() is passed a user provided input that contains all
zeroes (via crafted DNS message), it would crash with assertion
failure. Fix that by properly handling such input.
2020-08-05 15:51:50 +02:00
Petr Menšík and Mark Andrews
72e4be21f1
Remove few lines in unix socket handling
...
Reuse the same checks two times, make difference minimal.
(cherry picked from commit 72d81c4768 )
2020-07-24 13:59:17 +10:00
Tinderbox User and Michał Kępień
8345bf5f0e
prep 9.11.21
2020-07-15 23:24:25 +02:00
Mark Andrews
4f25e8ee92
Mark 'addr' as unused if HAVE_IF_NAMETOINDEX is not defined
...
Also 'zone' should be initialised to zero.
(cherry picked from commit e7662c4c63 )
2020-07-14 10:55:17 +10:00
Mark Andrews
a878e8d4bc
Address potential thread issues:
...
Assign and then check node for NULL to address another thread
changing radix->head in the meantime.
Move 'node != NULL' check into while loop test to silence cppcheck
false positive.
Fix pointer != NULL style.
(cherry picked from commit 51f08d2095 )
2020-06-25 21:18:45 +10:00
Tinderbox User and Michał Kępień
fc8107adca
prep 9.11.20
2020-06-18 10:37:47 +02:00
Mark Andrews
1f1209e1f6
Add +yaml support for EDE
...
(cherry picked from commit 0ec77c2b92 )
2020-06-05 12:10:53 +10:00
Witold Kręcicki and Ondřej Surý
c6ec2aaedc
tests: fix isc/socket_test.c teardown
...
In case of a test failure we weren't tearing down sockets and tasks
properly, causing the test to hang instead of failing nicely.
(cherry picked from commit 4a8d9250cf )
2020-06-03 14:17:16 +02:00
Mark Andrews
c0d34e8b05
Report Extended DNS Error codes
...
(cherry picked from commit b144ae1bb0 )
(cherry picked from commit eed4fab37b )
2020-05-13 12:18:55 +10:00
Michał Kępień
255be080cf
Tweak library API versions
2020-04-16 23:10:26 +02:00
Ondřej Surý
5e2d19911f
_getcwd() on Windows needs direct.h header
...
The _getcwd() compatibility function on Microsoft CRT requires direct.h
header to pull a proper function prototype.
The (misleading) warning generated:
bin\named\server.c(1074): warning C4047: '==': 'int' differs in levels of indirection from 'void *'
2020-04-16 13:13:00 +02:00
Ondřej Surý
7f672ab47d
Add default return value in win32 isc_thread_join()
2020-04-16 08:22:40 +02:00
Ondřej Surý
5fd1df8cfa
Disable MSB8028 warning
...
All our MSVS Project files share the same intermediate directory. We
know that this doesn't cause any problems, so we can just disable the
detection in the project files.
Example of the warning:
warning MSB8028: The intermediate directory (.\Release\) contains files shared from another project (dnssectool.vcxproj). This can lead to incorrect clean and rebuild behavior.
(cherry picked from commit b6c2012d93 )
2020-04-16 08:12:39 +02:00
Ondřej Surý
90108d479f
Don't return from void function
...
(cherry picked from commit 948a23e6bb )
2020-04-16 08:12:39 +02:00
Ondřej Surý
1eb5a77baa
Set WarningLevel to Level1 for Release, treat warnings as errors
...
Our vcxproj files set the WarningLevel to Level3, which is too verbose
for a code that needs to be portable. That basically leads to ignoring
all the errors that MSVC produces. This commits downgrades the
WarningLevel to Level1 and enables treating warnings as errors for
Release builds. For the Debug builds the WarningLevel got upgraded to
Level4, and treating warnings as errors is explicitly disabled.
We should eventually make the code clean of all MSVC warnings, but it's
a long way to go for Level4, so it's more reasonable to start at Level1.
For reference[1], these are the warning levels as described by MSVC
documentation:
* /W0 suppresses all warnings. It's equivalent to /w.
* /W1 displays level 1 (severe) warnings. /W1 is the default setting
in the command-line compiler.
* /W2 displays level 1 and level 2 (significant) warnings.
* /W3 displays level 1, level 2, and level 3 (production quality)
warnings. /W3 is the default setting in the IDE.
* /W4 displays level 1, level 2, and level 3 warnings, and all level 4
(informational) warnings that aren't off by default. We recommend
that you use this option to provide lint-like warnings. For a new
project, it may be best to use /W4 in all compilations. This option
helps ensure the fewest possible hard-to-find code defects.
* /Wall displays all warnings displayed by /W4 and all other warnings
that /W4 doesn't include — for example, warnings that are off by
default.
* /WX treats all compiler warnings as errors. For a new project, it
may be best to use /WX in all compilations; resolving all warnings
ensures the fewest possible hard-to-find code defects.
1. https://docs.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level?view=vs-2019
(cherry picked from commit 789d253e3d )
2020-04-16 08:12:39 +02:00
Ondřej Surý
ff814288af
Fix 'Dead nested assignment' from scan-build-10
...
This is the warning:
In file included from print_test.c:47:
./../print.c:203:9: warning: Although the value stored to 'neg' is used in the enclosing expression, the value is never actually read from 'neg'
dot = neg = space = plus = left = zero = alt = h = l = q = z = 0;
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
2020-03-26 13:52:28 +01:00
Tinderbox User and Matthijs Mekking
4236979e90
Adjust lib/isc/api version
...
The libisc LIBINTERFACE bump for 9.11.17 is unnecessary.
A lot of headers were altered but the ABI tool did not report anything.
Trust the ABI tool on this and decrement LIBINTERFACE and increment
LIBREVISION.
2020-03-20 10:32:32 +01:00
Tinderbox User and Matthijs Mekking
d050ec2429
prep 9.11.17
...
Bumped the version file and added release line in CHANGES.
API files:
- lib/bind9/api:
No changes because only changes in comments.
- lib/dns/api:
Increment LIBINTERFACE because of the added field structure in
dns_struct_update.
- lib/isc/api:
Increment LIBINTERFACE because of the PKCS#11 replacement.
- lib/isccc/api:
No changes because no source code changes.
- lib/isccfg/api:
Increment LIBREVISION because of minor source code changes.
- lib/lwres/api:
No changes because no source code changes.
I decided no changes to README.md or the release notes were necessary.
Perflab graphs look sane.
2020-03-20 10:31:29 +01:00
Mark Andrews
0ddfa675e4
Just return tv_sec field
2020-03-18 06:36:10 +00:00
Ondřej Surý and Evan Hunt
5ae4d3d94a
Add C11 localtime_r and gmtime_r shims for Windows
...
On Windows, C11 localtime_r() and gmtime_r() functions are not
available. While localtime() and gmtime() functions are already thread
safe because they use Thread Local Storage, it's quite ugly to #ifdef
around every localtime_r() and gmtime_r() usage to make the usage also
thread-safe on POSIX platforms.
The commit adds wrappers around Windows localtime_s() and gmtime_s()
functions.
NOTE: The implementation of localtime_s and gmtime_s in Microsoft CRT
are incompatible with the C standard since it has reversed parameter
order and errno_t return type.
(cherry picked from commit 08f4c7d6c0 )
2020-03-17 15:45:35 -07:00
Evan Hunt
1dbd238c15
fix a pointer-to-int cast error
...
(cherry picked from commit 6b76646037 )
2020-03-17 13:16:07 -07:00
Mark Andrews
8fce52189e
Fix lists of installed header files
2020-03-06 13:09:47 +11:00
Michał Kępień
ae7c0cca89
Fix cppcheck 1.89 warnings
...
cppcheck 1.89 enabled certain value flow analysis mechanisms [1] which
trigger null pointer dereference false positives that were previously
not reported. It seems that cppcheck no longer treats at least some
REQUIRE() assertion failures as fatal, so add extra assertion macro
definitions to lib/isc/include/isc/util.h that are only used when the
CPPCHECK preprocessor macro is defined; these definitions make cppcheck
1.89 behave as expected.
There is an important requirement for these custom definitions to work:
cppcheck must properly treat abort() as a function which does not
return. In order for that to happen, the __GNUC__ macro must be set to
a high enough number (because system include directories are used and
system headers compile attributes away if __GNUC__ is not high enough).
__GNUC__ is thus set to the major version number of the GCC compiler
used, which is what that latter does itself during compilation.
[1] https://github.com/danmar/cppcheck/commit/aaeec462e6d96bb70c2b1cf030979d09e2d7c959
(cherry picked from commit abfde3d543 )
2020-03-04 12:41:01 +01:00