Commit Graph
8955 Commits
Author SHA1 Message Date
Evan Hunt c94559480e fix a typo in rpz test
"tcp-only" was not being tested correctly in the RPZ system test
because the option to the "digcmd" function that causes queries to
be sent via TCP was misspelled in one case, and was being interpreted
as a query name.

the "ckresult" function has also been changed to be case sensitive
for consistency with "digcmd".

(cherry picked from commit 78af071c11)
2020-10-28 22:42:37 -07:00
Michal Nowak 523050f054 Fix system test backtrace generation on OpenBSD
On Linux core dump contains absolute path to crashed binary

    Core was generated by `/home/newman/isc/ws/bind9/bin/named/.libs/lt-named -D glue-ns1 -X named.lock -m'.

However, on OpenBSD there's only a basename

    Core was generated by `named'.

This commit adds support for the latter, retains the former.

(cherry picked from commit f0b13873a3)
(cherry picked from commit 659feff963)
2020-10-26 16:58:30 +01:00
Diego Fronza 29043867c7 Update copyrights 2020-10-26 10:45:27 -03:00
Diego Fronza 4fef8acbfa Adjusted additional system test (NS, non-root zone)
After the updates from this branch, BIND now sends glue records for
NS queries even when configured with minimal-responses yes.
2020-10-26 10:45:27 -03:00
Diego Fronza acef95ce44 Added test for the proposed fix
This test is very simple, two nameserver instances are created:
    - ns4: master, with 'minimal-responses yes', authoritative
        for example. zone
    - ns5: slave, stub zone

The first thing verified is the transfer of zone data from master
to slave, which should be saved in ns5/example.db.

After that, a query is issued to ns5 asking for target.example.
TXT, a record present in the master database with the "test" string
as content.

If that query works, it means stub zone successfully request
nameserver addresses from master, ns4.example. A/AAAA

The presence of both A/AAAA records for ns4 is also verified in the
stub zone local file, ns5/example.db.
2020-10-26 10:45:27 -03:00
Diego Fronza 07564aedcf Always return address records in additional section for NS queries 2020-10-26 10:45:27 -03:00
Michal Nowak e0af53ac0f Ensure use of "echo_i" where possible
In many instances 'echo "I:' construct was used where echo_i function
should have been.
2020-10-22 12:16:24 +02:00
Diego Fronza 0cd414a390 Fix dnstap system test on FreeBSD
This commit ensures that dnstap output files captured
by fstrm_capture are properly flushed before any attempt
on reading them with dnstap-read is done.

By reading fstrm-capture source code it was noticed that
signal SIGHUP is used to flush the capture file.
2020-10-20 10:39:48 -03:00
Mark Andrews 140659c57a Drop the expected minimum number of buckets to 4.
The previous value of 5 produced too many false errors.

(cherry picked from commit 0abb49034e)
2020-10-15 12:32:26 +11:00
Mark Andrews 96399960c1 Try to improve rrl timing
Add a +burst option to mdig so that we have a second to setup the
mdig calls then they run at the start of the next second.

RRL uses 'queries in a second' as a approximation to
'queries per second'. Getting the bursts of traffic to all happen in
the same second should prevent false negatives in the system test.

We now have a second to setup the traffic in.  Then the traffic should
be sent at the start of the next second.  If that still fails we
should move to +burst=<now+2> (further extend mdig) instead of the
implicit <now+1> as the trigger second.

(cherry picked from commit 92cdc7b6c7)
2020-10-15 11:47:08 +11:00
Michal Nowak d7ea583ad0 Bring back --rpz-log-qtype-qclass feature-test option
It was unintentionally removed during a backport.
2020-10-07 11:24:16 +02:00
Ondřej SurýandOndřej Surý d7b16b780f Adjust legacy tests for default 1232 EDNS Buffer Size
* legacy test was just expecting default server EDNS buffer size to be 4096,
  the test needed the adjustment to reset the buffer sizes back to 4096.
2020-10-06 09:34:49 +02:00
Ondřej Surý 3ab08cdaa4 Adjust digdelv tests for default 1232 EDNS Buffer Size
* digdelv test was just expecting default server EDNS buffer size to be
  4096, the test needed only slight adjustment

(cherry picked from commit f1556f8c41)
(cherry picked from commit 6b303721f1ee472dc8ab2d1df03191a98d4e4e5e)
2020-10-05 17:00:24 +02:00
Ondřej Surý c164c9a819 Change the default ENDS buffer size to 1232 for DNS Flag Day 2020
The DNS Flag Day 2020 aims to remove the IP fragmentation problem from
the UDP DNS communication.  In this commit, we implement the minimal
required changes by changing the defaults for `edns-udp-size`,
`max-udp-size` and `nocookie-udp-size` to `1232` (the value picked by
DNS Flag Day 2020).

(cherry picked from commit bb990030d3)
(cherry picked from commit df06773f9a73e4a4bb0b5e7f4bd8e40394e64032)
2020-10-05 16:54:39 +02:00
Diego FronzaandOndřej Surý 79c62017eb Properly handling dns_message_t shared references
This commit fix the problems that arose when moving the dns_message_t
object from fetchctx_t to the query structure.

Since the lifetime of query objects are different than that of a
fetchctx and the dns_message_t object held by the query may be being
used by some external module, e.g. validator, even after the query may
have been destroyed, propery handling of the references to the message
were added in this commit to avoid accessing an already destroyed
object.

Specifically, in resquery_response(), a reference to the message is
attached at the beginning of the function and detached at the end, since
a possible call to fctx_cancelquery() would release the dns_message_t
object, and in the next lines of code a call to add_bad() would require
a valid pointer to the same object.

In valcreate() a new reference is attached to the message object, this
ensures that if the corresponding query object is destroyed before the
validator attempts to access it, no invalid pointer access occurs.

In validated() we have to attach a new reference to the message, since
we destroy the validator object at the beginning of the function, and we
need access to the message in the next lines of the same function.
2020-09-30 14:04:04 +02:00
Diego FronzaandOndřej Surý 8781aef52e Refactored dns_message_t for using attach/detach semantics
This commit will be used as a base for the next code updates in order
to have a better control of dns_message_t objects' lifetime.
2020-09-30 13:33:43 +02:00
Mark Andrews d95a18711b Break lock order loop by sending TAT in an event
The dotat() function has been changed to send the TAT
query asynchronously, so there's no lock order loop
because we initialize the data first and then we schedule
the TAT send to happen asynchronously.

This breaks following lock-order loops:

zone->lock (dns_zone_setviewcommit) while holding view->lock
(dns_view_setviewcommit)

keytable->lock (dns_keytable_find) while holding zone->lock
(zone_asyncload)

view->lock (dns_view_findzonecut) while holding keytable->lock
(dns_keytable_forall)

(cherry picked from commit 3c4b68af7c)
2020-09-22 23:35:39 +10:00
Mark Andrews 7247df0fcf Lock access to control->symtab to prevent data race
WARNING: ThreadSanitizer: data race
    Read of size 8 at 0x000000000001 by thread T1:
    #0 isccc_symtab_foreach lib/isccc/symtab.c:277:14
    #1 isccc_cc_cleansymtab lib/isccc/cc.c:954:2
    #2 control_recvmessage bin/named/controlconf.c:477:2
    #3 recv_data lib/isccc/ccmsg.c:110:2
    #4 read_cb lib/isc/netmgr/tcp.c:769:4
    #5 <null> <null>

    Previous write of size 8 at 0x000000000001 by thread T2:
    #0 isccc_symtab_define lib/isccc/symtab.c:242:2
    #1 isccc_cc_checkdup lib/isccc/cc.c:1026:11
    #2 control_recvmessage bin/named/controlconf.c:478:11
    #3 recv_data lib/isccc/ccmsg.c:110:2
    #4 read_cb lib/isc/netmgr/tcp.c:769:4
    #5 <null> <null>

    Location is heap block of size 190352 at 0x000000000011 allocated by main thread:
    #0 malloc <null>
    #1 isccc_symtab_create lib/isccc/symtab.c:76:18
    #2 isccc_cc_createsymtab lib/isccc/cc.c:948:10
    #3 named_controls_create bin/named/controlconf.c:1483:11
    #4 named_server_create bin/named/server.c:10057:2
    #5 setup bin/named/main.c:1256:2
    #6 main bin/named/main.c:1523:2

    Thread T1 (running) created by main thread at:
    #0 pthread_create <null>
    #1 isc_thread_create lib/isc/pthreads/thread.c:73:8
    #2 isc_nm_start lib/isc/netmgr/netmgr.c:215:3
    #3 create_managers bin/named/main.c:909:15
    #4 setup bin/named/main.c:1223:11
    #5 main bin/named/main.c:1523:2

    Thread T2 (running) created by main thread at:
    #0 pthread_create <null>
    #1 isc_thread_create lib/isc/pthreads/thread.c:73:8
    #2 isc_nm_start lib/isc/netmgr/netmgr.c:215:3
    #3 create_managers bin/named/main.c:909:15
    #4 setup bin/named/main.c:1223:11
    #5 main bin/named/main.c:1523:2

    SUMMARY: ThreadSanitizer: data race lib/isccc/symtab.c:277:14 in isccc_symtab_foreach

(cherry picked from commit 0450acc1b6)
2020-09-17 20:06:27 +10:00
Tinderbox UserandMichał 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 e5ecb7f57d Wait for test instance of named to exit before completing subtest.
(cherry picked from commit dda5b7b0b8)
2020-09-10 20:41:00 +10:00
Mark Andrews 6dcdee08e9 Don't use production address (127.0.0.1) in runtime system test.
(cherry picked from commit 1f14705938)
2020-09-10 20:21:03 +10:00
Mark Andrews dc30a355bd Also wait for 'zone_dump: zone example/IN: enter'
use nextpartpeek as we don't want to reset the starting point

(cherry picked from commit 7b65bea6d2)
2020-09-10 18:48:52 +10:00
Mark Andrews ed0cb2e9e4 Use ns_g_server->recursionquota instead of client->recursionquota
as the later will be NULL on ISC_R_QUOTA.

*** CID 306732:  Null pointer dereferences  (FORWARD_NULL)
/bin/named/query.c: 4359 in query_recurse()
4353     			static _Atomic(isc_stdtime_t) last = 0;
4354     #else
4355     			static isc_stdtime_t last = 0;
4356     #endif
4357     			isc_stdtime_t now;
4358     			isc_stdtime_get(&now);
   CID 306732:  Null pointer dereferences  (FORWARD_NULL)
   Passing "client" to "log_quota", which dereferences null "client->recursionquota".
4359     			log_quota(client, &last, now,
4360     				  "no more recursive clients (%d/%d/%d): %s",
4361     				  isc_result_totext(result));
4362     			ns_client_killoldestquery(client);
4363     		}
4364     		if (result == ISC_R_SUCCESS && !client->mortal &&

** CID 306731:  Program hangs  (LOCK)
/lib/dns/resolver.c: 8943 in spillattimer_countdown()
2020-09-09 06:01:54 +00: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 6d9b1ed70c Address data race over query_recurse.last
WARNING: ThreadSanitizer: data race
  Read of size 4 at 0x000000000001 by thread T1:
    #0 query_recurse bin/named/query.c:4291:15
    #1 query_find bin/named/query.c
    #2 ns_query_start bin/named/query.c:9675:8
    #3 client_request bin/named/client.c:3133:3
    #4 dispatch lib/isc/task.c:1157:7
    #5 run lib/isc/task.c:1331:2

  Previous write of size 4 at 0x000000000001 by thread T2:
    #0 query_recurse bin/named/query.c:4292:10
    #1 query_find bin/named/query.c
    #2 ns_query_start bin/named/query.c:9675:8
    #3 client_request bin/named/client.c:3133:3
    #4 dispatch lib/isc/task.c:1157:7
    #5 run lib/isc/task.c:1331:2

  Location is global 'query_recurse.last' of size 4 at 0x000000000001
2020-09-08 09:25:43 +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 be4ed41611 Obtain a lock on the quota structure.
WARNING: ThreadSanitizer: data race (pid=15228)
  Read of size 4 at 0x7b5c00000444 by thread T8:
    #0 ns_server_status /builds/isc-projects/bind9/bin/named/./server.c:10935:31 (named+0x514671)
    #1 ns_control_docommand /builds/isc-projects/bind9/bin/named/control.c:263:12 (named+0x4e4726)
    #2 control_recvmessage /builds/isc-projects/bind9/bin/named/controlconf.c:465:13 (named+0x4e9046)
    #3 dispatch /builds/isc-projects/bind9/lib/isc/task.c:1157:7 (libisc.so.1107+0x50845)
    #4 run /builds/isc-projects/bind9/lib/isc/task.c:1331:2 (libisc.so.1107+0x4d799)

  Previous write of size 4 at 0x7b5c00000444 by thread T9 (mutexes: write M1082):
    #0 isc_quota_release /builds/isc-projects/bind9/lib/isc/quota.c:73:13 (libisc.so.1107+0x3bf10)
    #1 isc_quota_detach /builds/isc-projects/bind9/lib/isc/quota.c:111:2 (libisc.so.1107+0x3c12b)
    #2 ns_client_endrequest /builds/isc-projects/bind9/bin/named/client.c:896:3 (named+0x4dcad1)
    #3 exit_check /builds/isc-projects/bind9/bin/named/client.c:512:3 (named+0x4d570d)
    #4 ns_client_detach /builds/isc-projects/bind9/bin/named/client.c:3687:8 (named+0x4d7732)
    #5 query_find /builds/isc-projects/bind9/bin/named/query.c (named+0x4f8ff1)
    #6 query_resume /builds/isc-projects/bind9/bin/named/query.c:4164:12 (named+0x509b38)
    #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)
2020-09-08 09:25:43 +10:00
Mark Andrews 818520216d Missing locks in ns_lwresd_shutdown.
WARNING: ThreadSanitizer: data race
  Read of size 8 at 0x000000000001 by main thread:
    #0 ns_lwresd_shutdown bin/named/lwresd.c:885:3
    #1 destroy_managers bin/named/./main.c:938:2
    #2 cleanup bin/named/./main.c:1346:2
    #3 main bin/named/./main.c:1594:2

  Previous write of size 8 at 0x000000000001 by thread T1 (mutexes: write M1):
    #0 configure_listener bin/named/lwresd.c:768:2
    #1 ns_lwresd_configure bin/named/lwresd.c:836:5
    #2 load_configuration bin/named/./server.c:8230:2
    #3 run_server bin/named/./server.c
    #4 dispatch lib/isc/task.c:1157:7
    #5 run lib/isc/task.c:1331:2
2020-09-08 09:25:43 +10:00
Mark Andrews 00d315046b Defer read of zl->server and zl->reconfig until
the reference counter has gone to zero and there is
nolonger a possibility of changes in other threads.
2020-09-08 09:25:43 +10:00
Mark Andrews a26d0c5ef3 Access ns_client_requests atomically 2020-09-08 09:25:43 +10:00
Mark Andrews 690f557b09 Don't run dyndb and dlzexternal if running TSAN as
the dlopen flags being used are incompatible with TSAN.

(cherry picked from commit 86316ed29d)
2020-09-08 08:46:14 +10:00
Mark Andrews b66b5a096c alphabetize tests/usage
(cherry picked from commit bbece7389e)
2020-09-08 08:43:45 +10:00
Mark Andrews b1c36e7818 Check 'deny name' + 'grant subdomain' for the same name
(cherry picked from commit a402ffbced)
2020-09-03 16:22:54 +10:00
Mark Andrews b2c93102de Increase zone load timeout in the "rndc" test
The "huge.zone" zone can take longer than 100 seconds to load when
running under a sanitizer.  Increase the relevant zone load timeout to
prevent intermittent failures of the "rndc" system test.

(cherry picked from commit fd08918df5)
2020-09-03 07:15:54 +10:00
Mark Andrews 46dc1c34f9 dig +bufsize=0 failed to disable EDNS as a side effect.
(cherry picked from commit 0dc04cb901)
2020-09-02 20:47:19 +10:00
Mark AndrewsandOndřej Surý c237ca4d43 Dump the returned packet 2020-09-02 08:54:40 +02:00
Ondřej Surý 36ec930560 Add -r <repeats> option to packet.pl
For some tests, we need to send big data streams (for TCP) or repeated
packets (for UDP), this commits adds `-r` option to packet.pl that sends
the same input <repeats> times using the specified protocol.

(cherry picked from commit dd46559a19)
2020-09-02 08:54:40 +02:00
Ondřej Surý abae6c0f95 Properly format 2037-pk11_numbits-crash-test.pkt file
(cherry picked from commit 22e0272063)
2020-09-02 08:54:40 +02:00
Ondřej SurýandOndřej Surý a40151fe76 Add PoC system test for pk11_numbits() assertion
(cherry picked from commit a69433ba40)
2020-08-31 11:49:36 +02:00
Mark AndrewsandOndřej Surý 78d0355f30 check that a malformed truncated response to a TSIG query is handled
(cherry picked from commit 8bbf3eb5f3)
2020-08-31 08:35:10 +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
Michal Nowak d79c96da01 Make sure .txt files are not identified as crashed test
Previously .txt files with full backtrace may be identified as a
crashed test:

    I:Core dumps were found for the following system tests:
    I:	 core.19948-backtrace.txt
    I:   shutdown

Now .txt files are removed from the list.

Change 'run.sh.in' to match the core matching pattern in
'testsummary.sh'.

(cherry picked from commit c2dcd95966)
(cherry picked from commit 01119ac4f9)
2020-08-12 09:56:16 +02:00
Mark Andrews 1cc06636fc Ensure rl_message() gets prototype.
(cherry picked from commit fd126553d4)
2020-08-12 09:46:31 +10:00
Mark Andrews fd370a250d Stop deprecated functions being defined
(cherry picked from commit 1532a34658)
2020-08-12 09:42:34 +10:00
Mark Andrews f155ff75e4 Check isc_mutex_init() return values 2020-08-11 01:19:02 +00:00
Mark AndrewsandMichał Kępień 58e560beb5 Add a test for update-policy 'zonesub'
The new test checks that 'update-policy zonesub' is properly enforced.
2020-08-05 15:55:14 +02:00
Mark AndrewsandMichał Kępień 393e8f643c Add a test for update-policy 'subdomain'
The new test checks that 'update-policy subdomain' is properly enforced.
2020-08-05 15:55:14 +02:00
Mark AndrewsandMichał Kępień e4cccf9668 Update-policy 'subdomain' was incorrectly treated as 'zonesub'
resulting in names outside the specified subdomain having the wrong
restrictions for the given key.
2020-08-05 15:55:14 +02:00
Mark Andrews d3281b80a9 Check rcode is FORMERR
(cherry picked from commit 88ff6b846c)
2020-08-04 23:08:49 +10:00