Commit Graph

28069 Commits

Author SHA1 Message Date
Mark Andrews
3114ff2346 make FCTX_ATTR_SHUTTINGDOWN a independent bool 2019-12-03 08:51:44 +11:00
Michał Kępień
4c75e24e4c Merge branch 'michal/address-asan-memory-leak-reports-v9_11' into 'v9_11'
[v9_11] Address ASAN memory leak reports

See merge request isc-projects/bind9!2684
2019-12-02 18:24:44 +00:00
Michał Kępień
e396979233 Move xmlInitThreads()/xmlCleanupThreads() calls
xmlInitThreads() and xmlCleanupThreads() are called from within
ns_statschannels_configure() and ns_statschannels_shutdown(),
respectively.  Both of these functions are executed by worker threads,
not the main named thread.  This causes ASAN to report memory leaks like
the following one upon shutdown (as long as named is asked to produce
any XML output over its configured statistics channels during its
lifetime):

    Direct leak of 968 byte(s) in 1 object(s) allocated from:
        #0 0x7f677c249cd8 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:153
        #1 0x7f677bc1838f in xmlGetGlobalState (/usr/lib/libxml2.so.2+0xa838f)

The data mentioned in the above report is a libxml2 state structure
stored as thread-specific data.  Such chunks of memory are automatically
released (by a destructor passed to pthread_key_create() by libxml2)
whenever a thread that allocated a given chunk exits.  However, if
xmlCleanupThreads() is called by a given thread before it exits, the
destructor will not be invoked (due to xmlCleanupThreads() calling
pthread_key_delete()) and ASAN will report a memory leak.  Thus,
xmlInitThreads() and xmlCleanupThreads() must not be called from worker
threads.  Since xmlInitThreads() must be called on Windows in order for
libxml2 to work at all, move xmlInitThreads() and xmlCleanupThreads()
calls to the main named thread (which does not produce any XML output
itself) in order to prevent the memory leak from being reported by ASAN.

(cherry picked from commit b425b5d56e)
2019-12-02 17:10:03 +01:00
Michał Kępień
998d873f13 Merge branch '1445-fix-geoip2-memory-leak-upon-reconfiguration-v9_11' into 'v9_11'
[v9_11] Fix GeoIP2 memory leak upon reconfiguration

See merge request isc-projects/bind9!2682
2019-12-02 16:07:31 +00:00
Michał Kępień
36f79b1f9c Add CHANGES entry
5329.	[bug]		Reconfiguring named caused memory to be leaked when any
			GeoIP2 database was in use. [GL #1445]

(cherry picked from commit 628b1837d2)
2019-12-02 15:27:09 +01:00
Michał Kępień
95a5589fa2 Fix GeoIP2 memory leak upon reconfiguration
Loaded GeoIP2 databases are only released when named is shut down, but
not during server reconfiguration.  This causes memory to be leaked
every time "rndc reconfig" or "rndc reload" is used, as long as any
GeoIP2 database is in use.  Fix by releasing any loaded GeoIP2 databases
before reloading them.  Do not call dns_geoip_shutdown() until server
shutdown as that function releases the memory context used for caching
GeoIP2 lookup results.

(cherry picked from commit 670afbe84a)
2019-12-02 15:27:00 +01:00
Mark Andrews
27a5c5788a Merge branch '1417-threadsanitizer-data-race-rbtdb-c-1535-in-add32-v9_11' into 'v9_11'
Resolve "ThreadSanitizer: data race rbtdb.c:1535 in add32"

See merge request isc-projects/bind9!2665
2019-11-28 20:35:50 +00:00
Mark Andrews
8343d7dc2c add CHANGES
(cherry picked from commit 68693f8279)
2019-11-29 07:13:04 +11:00
Mark Andrews
1c61f129c3 rdataset_setownercase and rdataset_getownercase need to obtain a node lock
(cherry picked from commit 637b2c4e51)
2019-11-29 07:13:04 +11:00
Ondřej Surý
a5fb8c8127 Merge branch '1350-threadsanitizer-data-race-rbt-c-1312-in-dns_rbt_addnode-v9_11' into 'v9_11'
Resolve "ThreadSanitizer: data race rbt.c:1312 in dns_rbt_addnode"

See merge request isc-projects/bind9!2651
2019-11-27 17:06:28 +00:00
Mark Andrews
449f96c7bb add comments 'tree_lock(write) must be held'
(cherry picked from commit 8f6aaa7230)
2019-11-27 18:06:05 +01:00
Mark Andrews
37f6845980 rbtnode->nsec needs to be read while holding the tree lock
(cherry picked from commit 7cad3b2e91)
2019-11-27 18:06:05 +01:00
Ondřej Surý
97918a7315 Merge branch 'mnowak/537_Add_CI_step_to_test_named_-u-v9_11' into 'v9_11'
[9.11] Verifying that named switches UID

See merge request isc-projects/bind9!2600
2019-11-27 11:52:09 +00:00
Michal Nowak
412edf8982 Verifying that named switches UID
This test runs only under root, which is required for the user-switch
`-u` option to work.

Closes #537.

(cherry picked from commit b00360537e)
2019-11-27 11:52:08 +00:00
Evan Hunt
0074d5542e Merge branch '1399-recursive-limit-stat-v9_11' into 'v9_11'
Resolve "recursive-client limit should have a stat counter"

See merge request isc-projects/bind9!2646
2019-11-26 19:54:38 +00:00
Evan Hunt
47da3129fd add a stats counter for clients dropped due to recursive-clients limit
(cherry picked from commit 715afa9c57)
2019-11-26 11:34:23 -08:00
Ondřej Surý
1fcfc7f4c4 Merge branch '1403-when-configuration-loading-fails-named-could-assert-v9_11' into 'v9_11'
Request exclusive access when crashing via fatal()

See merge request isc-projects/bind9!2638
2019-11-26 18:37:24 +00:00
Ondřej Surý
1e96fb8dc0 Request exclusive access when crashing via fatal()
When loading the configuration fails, there might be already other tasks
running and calling OpenSSL library functions.  The OpenSSL on_exit
handler is called when exiting the main process and there's a timing
race between the on_exit function that destroys OpenSSL allocated
resources (threads, locks, ...) and other tasks accessing the very same
resources leading to a crash in the system threading library. Therefore,
the fatal() function needs to request exlusive access to the task
manager to finish the already running tasks and exit only when no other
tasks are running.

(cherry picked from commit 952d7fde63)
2019-11-26 13:56:02 +01:00
Ondřej Surý
fff784b061 Merge branch 'ondrej/add-retry_quiet-function-to-conf.sh.common-v9_11' into 'v9_11'
Add retry_quiet() function to retry quietly for an event to occur

See merge request isc-projects/bind9!2632
2019-11-26 08:40:42 +00:00
Ondřej Surý
f5852f5f81 Add retry_quiet() function to retry quietly for an event to occur
(cherry picked from commit 31264a7e00)
2019-11-26 09:21:39 +01:00
Mark Andrews
0455351802 Merge branch '1367-threadsanitizer-data-race-dispatch-c-901-in-free_buffer-v9_11' into 'v9_11'
Resolve "ThreadSanitizer: data race dispatch.c:901 in free_buffer"

See merge request isc-projects/bind9!2628
2019-11-26 02:30:14 +00:00
Mark Andrews
d74a6a96c3 move maxbuffers test to allocate_udp_buffer
(cherry picked from commit 26a93d77aa)
2019-11-26 11:53:33 +11:00
Mark Andrews
1d928de33e Lock dispatch manager buffer_lock before accessing buffers;
Only test buffers for UDP dispatches.

(cherry picked from commit 011af4de71)
2019-11-26 11:53:33 +11:00
Mark Andrews
dcb21f39b6 lock disp->mgr before reading disp->mgr->buffers
(cherry picked from commit afc7389ce8)
2019-11-26 11:53:33 +11:00
Mark Andrews
40450fffc0 Merge branch '1397-install-isc-python-module-v9_11' into 'v9_11'
Resolve "Install ISC python module"

See merge request isc-projects/bind9!2626
2019-11-26 00:46:03 +00:00
Mark Andrews
dbd7d580e4 add CHANGES and note in README.md
(cherry picked from commit 8bbafeb5ef)
2019-11-26 10:04:53 +11:00
Mark Andrews
da75b8a7d1 check for 'distutils.core setup'
(cherry picked from commit 50e1bf3800)
2019-11-26 10:04:04 +11:00
Evan Hunt
542fb86f41 Merge branch 'each-notes-v9_11' into 'v9_11'
cleanup release notes text

See merge request isc-projects/bind9!2624
2019-11-25 21:21:18 +00:00
Evan Hunt
ad9c8efbf6 cleanup release notes text
(cherry picked from commit fa70fc8731)
2019-11-25 13:20:52 -08:00
Mark Andrews
e36730076a Merge branch '1334-threadsanitizer-data-race-dispatch-c-1339-in-tcp_recv-v9_11' into 'v9_11'
lock dispatch before reporting state

See merge request isc-projects/bind9!2619
2019-11-22 21:48:12 +00:00
Mark Andrews
9cffeb606a lock dispatch before reporting state
(cherry picked from commit 3075445ed6)
2019-11-23 08:25:47 +11:00
Mark Andrews
83d08bfb8e Merge branch '1317-alphabetise-delv-s-usage-v9_11' into 'v9_11'
alphabetise delv's usage.

See merge request isc-projects/bind9!2616
2019-11-22 19:34:06 +00:00
Mark Andrews
fcbabac0cd alphabetise delv's usage.
(cherry picked from commit 78685ed173)
2019-11-23 00:12:21 +11:00
Mark Andrews
b9be8bac52 Merge branch '1386-9-11-fix-conditional-define-of-lock_callback' into 'v9_11'
Resolve "9.11: fix conditional define of lock_callback"

See merge request isc-projects/bind9!2596
2019-11-21 00:18:33 +00:00
Mark Andrews
7d45e655a6 add CHANGES 2019-11-21 10:59:16 +11:00
Mark Andrews
9d4f5f88f3 Conditional compilation of lock_callback was inconsistent with
conditional use of the function when forcing BIND to build with
older and unsupported versions of OpenSSL.
2019-11-21 10:59:16 +11:00
Evan Hunt
5c4351d4bb Merge branch 'merge-v9_11_13' into 'v9_11'
merge 9.11.13 into v9_11 branch

See merge request isc-projects/bind9!2606
2019-11-20 21:47:53 +00:00
Evan Hunt
99203103b7 Merge tag 'v9_11_13' into merge-v9_11_13 2019-11-20 13:43:34 -08:00
Ondřej Surý
37f15ceaae Merge branch '1341-threadsanitizer-data-race-rbtdb-c-5756-in-add32-v9_11' into 'v9_11'
Resolve "ThreadSanitizer: data race rbtdb.c:5756 in add32"

See merge request isc-projects/bind9!2594
2019-11-19 17:33:58 +00:00
Mark Andrews
92a73a3abe add CHANGES
(cherry picked from commit 4534fb5ec1)
2019-11-20 01:05:03 +08:00
Mark Andrews
a64c9fae62 use update_recordsandbytes in rbt_datafixer
(cherry picked from commit 7d4d64340e)
2019-11-20 01:01:52 +08:00
Mark Andrews
cf78ae96e5 always obtain write lock when updating version->{records,bytes}
(cherry picked from commit 0cda448248)
2019-11-20 01:01:51 +08:00
Michał Kępień
fc91e783b1 Merge branch '1308-fix-tcp-system-test-v9_11' into 'v9_11'
[v9_11] Fix "tcp" system test

See merge request isc-projects/bind9!2592
2019-11-19 15:19:19 +00:00
Michał Kępień
87f7838a99 Address ShellCheck warnings
Address all outstanding warnings that ShellCheck reports for
bin/tests/system/tcp/tests.sh.

(cherry picked from commit 23ca0ec55b)
2019-11-19 15:46:55 +01:00
Michał Kępień
a390e261ad Use "set -e" in the "tcp" system test
Ensure any unexpected failure in the "tcp" system test causes it to be
immediately interrupted with an error to make the aforementioned test
more reliable.  Since the exit code for "expr 0 + 0" is 1, the status
variable needs to be updated using arithmetic expansion.

(cherry picked from commit 9841635b7f)
2019-11-19 15:46:35 +01:00
Michał Kępień
06705a0ee5 Ensure all "tcp" system test errors are caught
Ensure any "rndc stats" failure causes the "tcp" system test to fail.
Do not hide "rndc stats" output.

(cherry picked from commit 46df363a0d)
2019-11-19 15:46:34 +01:00
Michał Kępień
bc498bd6c9 Make all "tcp" system test checks numbered
Ensure all checks in the "tcp" system test are numbered, so that
forensic data is preserved in case of any failure.

(cherry picked from commit 2f4877d11c)
2019-11-19 15:46:04 +01:00
Michał Kępień
01a413cecc Fix argument order in assert_int_equal()
assert_int_equal() calls in bin/tests/system/tcp/tests.sh pass the found
value as the first argument and the expected value as the second
argument, while the function interprets its arguments the other way
round.  Fix argument handling in assert_int_equal() to make sure the
error messages printed by that function are correct.

(cherry picked from commit 6bd1f68bef)
2019-11-19 15:45:07 +01:00
Michał Kępień
3e9781087a Allow retries when checking TCP high-water stats
In the TCP high-water checks, "rndc stats" is run after ans6 reports
that it opened the requested number of TCP connections.  However, we
fail to account for the fact that ns5 might not yet have called accept()
for these connections, in which case the counts output by "rndc stats"
will be off.  To prevent intermittent "tcp" system test failures, allow
the relevant connection count checks to be retried (just once, after one
second, as that should be enough for any system to accept() a dozen TCP
connections under any circumstances).

(cherry picked from commit 1e22e052d0)
2019-11-19 15:43:16 +01:00
Mark Andrews
434615407e Merge branch '1299-parse-commandline-code-should-be-done-in-alphabetical-order-v9_11' into 'v9_11'
alphabetize command line switch

See merge request isc-projects/bind9!2590
2019-11-19 10:11:06 +00:00