Commit Graph

28101 Commits

Author SHA1 Message Date
Mark Andrews
4263b2ea21 address deadlock introduced in cd2469d3cd
(cherry picked from commit fd52417f71)
2019-12-10 20:24:05 +00:00
Matthijs Mekking
2de3f344ef Merge branch '1457-intermittent-failure-autosign-v9_11' into 'v9_11'
Resolve "Intermittent failure in the autosign system test"

See merge request isc-projects/bind9!2733
2019-12-10 14:21:16 +00:00
Matthijs Mekking
6d83b061ab Better error handling in autosign system test
(cherry picked from commit bd4035900a)
(cherry picked from commit 6658c11251)
2019-12-10 13:58:25 +00:00
Matthijs Mekking
677ea3aa05 Fix race in autosign test
The autosign test has a test case where a DNSSEC maintaiend zone
has a set of DNSSEC keys without any timing metadata set.  It
tests if named picks up the key for publication and signing if a
delayed dnssec-settime/loadkeys event has occured.

The test failed intermittently despite the fact it sleeps for 5
seconds but the triggered key reconfigure action should happen after
3 seconds.

However, the test output showed that the test query came in before
the key reconfigure action was complete (see excerpts below).

The loadkeys command is received:

15:38:36 received control channel command 'loadkeys delay.example.'

The reconfiguring zone keys action is triggered after 3 seconds:

15:38:39 zone delay.example/IN: reconfiguring zone keys
15:38:39 DNSKEY delay.example/NSEC3RSASHA1/7484 (ZSK) is now published
15:38:39 DNSKEY delay.example/NSEC3RSASHA1/7455 (KSK) is now published
15:38:39 writing to journal

Two seconds later the test query comes in:

15:38:41 client @0x7f1b8c0562b0 10.53.0.1#44177: query
15:38:41 client @0x7f1b8c0562b0 10.53.0.1#44177: endrequest

And 6 more seconds later the reconfigure keys action is complete:

15:38:47 zone delay.example/IN: next key event: 05-Dec-2019 15:48:39

This commit fixes the test by checking the "next key event" log has
been seen before executing the test query, making sure that the
reconfigure keys action has been complete.

This commit however does not fix, nor explain why it took such a long
time (8 seconds) to reconfigure the keys.

(cherry picked from commit 2e4273b55a)
(cherry picked from commit fb0ddd5bfe)
2019-12-10 13:58:24 +00:00
Matthijs Mekking
f346fbdec9 Introduce wait_for_log in autosign test
(cherry picked from commit 5d6fad9e1e)
2019-12-10 13:58:24 +00:00
Matthijs Mekking
ff44e1f086 Save settime output
(cherry picked from commit 6b4a17ef7c)
2019-12-10 13:58:24 +00:00
Michał Kępień
207c976807 Merge branch '1465-fix-idna-system-test-v9_11' into 'v9_11'
[v9_11] Fix the "idna" system test

See merge request isc-projects/bind9!2742
2019-12-10 13:38:32 +00:00
Michał Kępień
367a576f73 Use a different character for invalid U-label test
When libidn2 2.3.0+ is used, the "idna" system test fails as dig does
not fail as expected any more due to libidn2 2.3.0 using Unicode 11.0.0
IDNA mapping tables [1] instead of Unicode 6.3.0 ones which were used
until libidn2 2.2.0.  Specifically, the SOCKS character (🧦) used in the
invalid input U-label check in the "idna" system test is a valid IDNA
character as per the IDNA mapping tables for Unicode 11.0.0.  Fix the
relevant checks by using a different character (🟥) which is an invalid
IDNA character for all versions of Unicode released to date.

[1] 5eaafda64e
2019-12-10 12:01:49 +01:00
Michał Kępień
6966422bf9 Only use LC_ALL=C where intended
The LC_ALL=C assignments in the "idna" system test, which were only
meant to affect a certain subset of checks, in fact persist throughout
all the subsequent checks in that system test.  That affects the test's
behavior and is misleading.

When the "VARIABLE=value command ..." syntax is used in a shell script,
in order for the variable assignment to only apply to "command", the
latter must be an external binary; otherwise, the VARIABLE=value
assignment persists for all subsequent commands in a script:

    $ cat foo.sh
    #!/bin/sh

    foo() {
        /bin/sh bar.sh
    }

    BAR="baz0"
    BAR="baz1" /bin/sh bar.sh
    echo "foo: BAR=${BAR}"
    BAR="baz2" foo
    echo "foo: BAR=${BAR}"

    $ cat bar.sh
    #!/bin/sh

    echo "bar: BAR=${BAR}"

    $ /bin/sh foo.sh
    bar: BAR=baz1
    foo: BAR=baz0
    bar: BAR=baz2
    foo: BAR=baz2
    $

Fix by saving the value of LC_ALL before the relevant set of checks in
the "idna" system test, restoring it afterwards, and dropping the
"LC_ALL=C command ..." syntax.

(cherry picked from commit 2ee7ff23ce)
2019-12-10 12:01:26 +01:00
Michał Kępień
ed6fd9420d Merge branch '1452-system-test-framework-cleanup-tweaks-v9_11' into 'v9_11'
[v9_11] System test framework: cleanup tweaks

See merge request isc-projects/bind9!2723
2019-12-06 14:10:18 +00:00
Michał Kępień
26213ff696 Automatically run clean.sh from run.sh
The first step in all existing setup.sh scripts is to call clean.sh.  To
reduce code duplication and ensure all system tests added in the future
behave consistently with existing ones, invoke clean.sh from run.sh
before calling setup.sh.

(cherry picked from commit d8905b7a9c)
2019-12-06 15:06:49 +01:00
Michał Kępień
ef3a08226c Remove bin/tests/system/clean.sh
Since the role of the bin/tests/system/clean.sh script has now been
reduced to calling a given system test's clean.sh script, remove the
former altogether and replace its only use with a direct invocation of
the latter.

(cherry picked from commit bf3eeac067)
2019-12-06 15:06:49 +01:00
Michał Kępień
bc04dbf788 Remove the -r switch from system test scripts
Since files containing system test output are no longer stored in test
subdirectories, bin/tests/system/clean.sh no longer needs to take care
of removing the test.output file for a given test as testsummary.sh
already takes care of that and even if a test suite terminates
abnormally and another one is started, tee invoked without the -a
command line switch overwrites the destination file if it exists, so
leftover test.output.* files from previous test suite runs are not a
concern.  Remove the -r command line switch and the code associated with
it from the relevant scripts.

(cherry picked from commit b4d37878f6)
2019-12-06 15:06:49 +01:00
Michał Kępień
cbc56385b2 Store system test output in bin/tests/system/
Some clean.sh scripts contain overly broad file deletion wildcards which
cause the test.output file (used by the system test framework for
collecting output) in a given system test's directory to be erroneously
removed immediately after the test is started (due to setup.sh scripts
calling clean.sh at the beginning).  This prevents the test's output
from being placed in bin/tests/system/systests.output at the end of a
test suite run and thus can lead to test failures being ignored.  Fix by
storing each test's output in a test.output.<test-name> file in
bin/tests/system/, which prevents clean.sh scripts from removing it (as
they should only ever affect files contained in a given system test's
directory).

(cherry picked from commit b0916bba41)
2019-12-06 15:06:49 +01:00
Michał Kępień
e37da165c7 Merge branch '1452-detect-missing-system-test-results-v9_11' into 'v9_11'
[v9_11] Detect missing system test results

See merge request isc-projects/bind9!2722
2019-12-06 14:01:51 +00:00
Michał Kępień
fef7060935 Detect missing system test results
At the end of each system test suite run, the system test framework
collects all existing test.output files from system test subdirectories
and produces bin/tests/system/systests.output from those files.
However, it does not check whether a test.output file was found for
every executed test.  Thus, if the test.output file is accidentally
deleted by the system test itself (e.g. due to an overly broad file
removal wildcard present in clean.sh), its output will not be included
in bin/tests/system/systests.output.  Since the result of each system
test suite run is determined by bin/tests/system/testsummary.sh, which
only operates on the contents of bin/tests/system/systests.output, this
can lead to test failures being ignored.  Fix by ensuring the number of
test results found in bin/tests/system/systests.output is equal to the
number of tests run and triggering a system test suite failure in case
of a discrepancy between these two values.

(cherry picked from commit 3c3085be3c)
2019-12-06 14:42:13 +01:00
Ondřej Surý
5c18c39d49 Merge branch 'ondrej/note-about-atomics-in-v9_11' into 'v9_11'
Add note about atomics and statistic counters in BIND 9.11

See merge request isc-projects/bind9!2710
2019-12-05 14:30:50 +00:00
Ondřej Surý
fda9c28e36 Add NOTE about atomics and statschannel 2019-12-05 15:19:54 +01:00
Diego dos Santos Fronza
406c4d2ffa Merge branch '1398-new-tcp-high-water-setting-looks-incorrect-on-newly-started-server' into 'v9_11'
Resolve "New TCP High Water setting looks incorrect on a newly-started server"

See merge request isc-projects/bind9!2643
2019-12-05 01:56:29 +00:00
Ondřej Surý
e50abe8a70 Cleanup the isc_stats code 2019-12-04 19:39:57 -03:00
Diego Fronza
8680c367cd Fix tcp-higwater stats for some specific platforms
The previous code had some errors that would be triggered on platforms
without stdatomics but with support for xadd assembly instruction.

The major error was combining two uint32_t values from the
multifield atomic structure using a logical AND '&&' instead of a
bitwise OR '|'.

Some preprocessor rules were redundant and thus were simplified,
regarding the definition of ISC_STATS_USEMULTIFIELDS macro.

Correctly changed rwlock type to read on isc_stats_get_counter.
2019-12-04 19:39:56 -03:00
Mark Andrews
2b0b62bb3f Merge branch '1434-explicitly-set-python-to-a-empty-string-with-without-python-v9_11' into 'v9_11'
Resolve "explicitly set PYTHON to a empty string with --without-python"

See merge request isc-projects/bind9!2697
2019-12-03 13:40:27 +00:00
Mark Andrews
17b29261bd add AC_ARG_VAR([PYTHON], [path to python executable])
(cherry picked from commit eed2aabc40)
2019-12-03 13:16:27 +00:00
Mark Andrews
1c6aaadd0b add CHANGES
(cherry picked from commit 8cd3cf90b2)
2019-12-03 13:16:27 +00:00
Mark Andrews
4a18cb8029 unset PYTHON on --without-python to prevent python still being used
(cherry picked from commit d8fc544569)
2019-12-03 13:16:27 +00:00
Mark Andrews
68fe7bbe87 Merge branch '1416-threadsanitizer-data-race-resolver-c-3384-in-findname-v9_11' into 'v9_11'
Assign fctx->client when fctx is created rather when the join happens.

See merge request isc-projects/bind9!2695
2019-12-03 13:07:12 +00:00
Mark Andrews
56af72c1d4 Assign fctx->client when fctx is created rather when the join happens.
This prevents races on fctx->client whenever a new fetch joins a existing
fetch (by calling fctx_join) as it is now invariant for the active life of
fctx.

(cherry picked from commit 9ca6ad6311)
2019-12-03 23:39:47 +11:00
Mark Andrews
e0cb2d2d51 Merge branch '1419-threadsanitizer-data-race-rbtdb-c-7568-in-issecure-v9_11' into 'v9_11'
r/w of rbtdb->current_version requires that rbtdb->lock be held

See merge request isc-projects/bind9!2693
2019-12-03 06:23:11 +00:00
Mark Andrews
882d79b2a3 r/w of rbtdb->current_version requires that rbtdb->lock be held
(cherry picked from commit cd2469d3cd)
2019-12-03 16:50:06 +11:00
Mark Andrews
020fc08658 Merge branch '1446-add-fctx_attr_clr-and-fctx_attr_set-macros-v9_11' into 'v9_11'
Resolve "Add FCTX_ATTR_CLR and FCTX_ATTR_SET macros (v9_11)"

See merge request isc-projects/bind9!2691
2019-12-03 05:35:11 +00:00
Mark Andrews
37eb8e0d6c define and use FCTX_ATTR_SET and FCTX_ATTR_CLR 2019-12-03 11:41:05 +11:00
Mark Andrews
b67df854b5 Merge branch '1412-threadsanitizer-data-race-resolver-c-7030-in-fctx_decreference-3' into 'v9_11'
Resolve "ThreadSanitizer: data race resolver.c:7030 in fctx_decreference"

See merge request isc-projects/bind9!2674
2019-12-02 22:21:44 +00:00
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