Commit graph

32364 commits

Author SHA1 Message Date
Mark Andrews
b0f477df87 Call nta_detach() before dns_view_weakdetach() so view is available.
(cherry picked from commit ea956976d1)
2020-11-03 23:49:24 +11:00
Michał Kępień
711d954789 Merge branch '2237-fix-cross-compilation' into 'v9_16'
Fix cross-compilation

See merge request isc-projects/bind9!4312
2020-11-02 11:31:27 +00:00
Michał Kępień
f522a10801 Add CHANGES entry 2020-11-02 12:27:55 +01:00
Michał Kępień
35ca6df072 Fix cross-compilation
Using AC_RUN_IFELSE() in configure.ac breaks cross-compilation:

    configure: error: cannot run test program while cross compiling

Commit 978c7b2e89 caused AC_RUN_IFELSE()
to be used instead of AC_LINK_IFELSE() because the latter had seemingly
been causing the check for --wrap support in the linker to not work as
expected.  However, it later turned out that the problem lied elsewhere:
a minus sign ('-') was missing from the LDFLAGS variable used in the
relevant check [1].

Revert to using AC_LINK_IFELSE() for checking whether the linker
supports the --wrap option in order to make cross-compilation possible
again.

[1] see commit cfa4ea64bc
2020-11-02 12:27:55 +01:00
Michał Kępień
9ba5a4f6f8 Merge branch 'michal/sync-PLATFORMS-with-PLATFORMS.md' into 'v9_16'
Sync PLATFORMS with PLATFORMS.md

See merge request isc-projects/bind9!4339
2020-10-30 11:03:47 +00:00
Michał Kępień
188d130cc2 Sync PLATFORMS with PLATFORMS.md 2020-10-30 11:50:14 +01:00
Michał Kępień
74888fc997 Merge branch 'mnowak/OpenBSD_6.8-v9_16' into 'v9_16'
[v9_16] Update to OpenBSD 6.8

See merge request isc-projects/bind9!4336
2020-10-30 10:03:13 +00:00
Michal Nowak
f1066b3b41 Update to OpenBSD 6.8
(cherry picked from commit 773649f413)
2020-10-30 10:39:59 +01:00
Michał Kępień
2111bd5bc5 Merge branch '2231-miscellaneous-backtrace-fixes' into 'v9_16'
Miscellaneous backtrace fixes

See merge request isc-projects/bind9!4325
2020-10-30 08:16:30 +00:00
Michał Kępień
923c443389 Fix getrbp()
The following compiler warning is emitted for the BACKTRACE_X86STACK
part of lib/isc/backtrace.c:

    backtrace.c: In function ‘getrbp’:
    backtrace.c:142:1: warning: no return statement in function returning non-void [-Wreturn-type]

While getrbp() stores the value of the RBP register in the RAX register
and thus does attempt to return a value, this is not enough for an
optimizing compiler to always produce the expected result.  With -O2,
the following machine code may be generated in isc_backtrace_gettrace():

    0x00007ffff7b0ff7a <+10>:	mov    %rbp,%rax
    0x00007ffff7b0ff7d <+13>:	mov    $0x17,%eax
    0x00007ffff7b0ff82 <+18>:	retq

The above is equivalent to:

    sp = (void **)getrbp();
    return (ISC_R_NOTFOUND);

and results in the backtrace never getting printed.

Fix by using an intermediate variable.  With this change in place, the
machine code generated with -O2 becomes something like:

    0x00007ffff7af5638 <+24>:	mov    $0x17,%eax
    0x00007ffff7af563d <+29>:	mov    %rbp,%rdx
    0x00007ffff7af5640 <+32>:	test   %rdx,%rdx
    0x00007ffff7af5643 <+35>:	je     0x7ffff7af56bd <isc_backtrace_gettrace+157>
    ...
    0x00007ffff7af56bd <+157>:	retq

(Note that this method of grabbing a stack trace is finicky anyway
because in order for RBP to be relied upon, -fno-omit-stack-frame must
be present among CFLAGS.)
2020-10-30 09:12:50 +01:00
Michał Kępień
10d7055791 Check for _Unwind_Backtrace() support
Some operating systems (e.g. Linux, FreeBSD) provide the
_Unwind_Backtrace() function in libgcc_s.so, which is automatically
linked into any binary using the functions provided by that library.  On
OpenBSD, though, _Unwind_Backtrace() is provided by libc++abi.so, which
is not automatically linked into binaries produced by the stock system C
compiler.

Meanwhile, lib/isc/backtrace.c assumes that any GNU-compatible toolchain
allows _Unwind_Backtrace() to be used without any extra provisions in
the build system.  This causes build failures on OpenBSD (and possibly
other systems).

Instead of making assumptions, actually check for _Unwind_Backtrace()
support in the toolchain if the backtrace() function is unavailable.
2020-10-30 09:12:50 +01:00
Michał Kępień
1d0269a2a7 Merge branch '2228-fix-the-make-depend-check-in-gitlab-ci' into 'v9_16'
Fix the "make depend" check in GitLab CI

See merge request isc-projects/bind9!4316
2020-10-30 07:55:30 +00:00
Michał Kępień
1b5a8a914c Do not test "make depend" for out-of-tree builds
The make/mkdep script does not understand the concept of generated
source files (like lib/dns/dnstap.pb-c.c), which prevents it from
working correctly for out-of-tree builds.  As "make depend" is not
required for building BIND and the "depend" make target was removed
altogether in the development branch, just prevent the "make depend"
check from being performed for out-of-tree builds in GitLab CI instead
of trying to add support for handling generated source files to
make/mkdep.
2020-10-30 08:49:16 +01:00
Michał Kępień
0ab099ca09 Fix the "make depend" check in GitLab CI
"make depend" prints errors to stderr, not to stdout.  This means that
the check for "make depend" errors currently used in the definition of
every build job in GitLab CI could never fail.  Fix that check by
redirecting stderr to stdout.  Also employ tee to prevent the output of
"make depend" from being hidden in the job log.  (While using tee hides
the exit code of "make depend" itself, the next line still checks for
errors anyway.)
2020-10-30 08:49:16 +01:00
Mark Andrews
0a0ef9a9b3 Merge branch '2236-resolver-sometimes-treats-signed-insecure-zone-with-broken-dnskey-as-bogus-v9_16' into 'v9_16'
Resolve "Resolver sometimes treats signed, insecure zone with broken DNSKEY as bogus"

See merge request isc-projects/bind9!4332
2020-10-29 22:44:20 +00:00
Mark Andrews
d598da406d Add CHANGES note for [GL #2236]
(cherry picked from commit decf117eb6)
2020-10-30 09:19:12 +11:00
Mark Andrews
939e735e2c Check that a zone in the process of being signed resolves
ans10 simulates a local anycast server which has both signed and
unsigned instances of a zone.  'A' queries get answered from the
signed instance.  Everything else gets answered from the unsigned
instance.  The resulting answer should be insecure.

(cherry picked from commit d7840f4b93)
2020-10-30 09:19:12 +11:00
Mark Andrews
903c1136ef Handle DNS_R_NCACHENXRRSET in fetch_callback_{dnskey,validator}()
DNS_R_NCACHENXRRSET can be return when zones are in transition state
from being unsigned to signed and signed to unsigned.  The validation
should be resumed and should result in a insecure answer.

(cherry picked from commit 718e597def)
2020-10-30 08:21:43 +11:00
Michal Nowak
01bc68bc72 Merge branch 'mnowak/add-freebsd12.2-v9_16' into 'v9_16'
[v9_16] Update to FreeBSD 12.2

See merge request isc-projects/bind9!4329
2020-10-29 15:52:49 +00:00
Michal Nowak
283f0c1e75
Update to FreeBSD 12.2
(cherry picked from commit 11ab0528d9)
2020-10-29 16:28:01 +01:00
Michal Nowak
58a8873228 Merge branch 'mnowak/add-fedora-33-v9_16' into 'v9_16'
[v9_16] Add Fedora 33

See merge request isc-projects/bind9!4327
2020-10-29 15:18:42 +00:00
Michal Nowak
91e28d1fb4
Add Fedora 33
(cherry picked from commit 914be61ff8c5a3e0395acd980486c1b4cd656d20)
2020-10-29 14:00:19 +01:00
Ondřej Surý
02bdaa48fe Merge branch '2227-tcp-connection-closed-fix-v9_16' into 'v9_16'
Resolve "BIND 9.16.8 assertion failure"

See merge request isc-projects/bind9!4324
2020-10-29 12:51:38 +00:00
Witold Kręcicki
0f1810efb2 Add CHANGES and release note for GL #2227
(cherry picked from commit cd3117b747)
2020-10-29 13:23:25 +01:00
Witold Kręcicki
e1c75d00b7 Properly handle outer TCP connection closed in TCPDNS.
If the connection is closed while we're processing the request
we might access TCPDNS outerhandle which is already reset. Check
for this condition and call the callback with ISC_R_CANCELED result.

(cherry picked from commit c41ce8e0c9)
2020-10-29 13:21:55 +01:00
Evan Hunt
0ba073a1b8 Merge branch 'each-rpz-test-typo-v9_16' into 'v9_16'
fix a typo in rpz test

See merge request isc-projects/bind9!4321
2020-10-29 06:15:14 +00:00
Evan Hunt
bc9a1b0b2d 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:38:55 -07:00
Michal Nowak
f2a228d2fa Merge branch 'mnowak/test-coverage-visualization-v9_16' into 'v9_16'
Enable Test Coverage Visualization for merge requests

See merge request isc-projects/bind9!4314
2020-10-27 14:57:36 +00:00
Michal Nowak
2c9892ed1d
Enable Test Coverage Visualization for merge requests
This feature allows GitLab to visualize test coverage information in the
file diff view of merge requests.

This commit makes the gcov CI job depend on the following chain of jobs:

    gcc:buster:amd64 → unit:gcc:buster:amd64 → system:gcc:buster:amd64

The reason for running the last two jobs above sequentially rather than
in parallel is that both of them create *.gcda files (containing
coverage data) in the same locations.  While some way of merging these
files from different job artifact archives could probably be designed
with the help of additional tools, the simplest thing to do is not to
run unit test and system test jobs in parallel, carrying *.gcda files
over between jobs as gcov knows how to append coverage data to existing
*.gcda files.

Also note that test coverage will not be visualized if any of the jobs
in the above dependency chain fails (because the gcov job will not be
run).

(cherry picked from commit 2dabf328c4)
2020-10-27 15:57:06 +01:00
Michal Nowak
93efe7685c Merge branch 'mnowak/enhanced-test-portability-v9_16' into 'v9_16'
[v9_16] POSIX compatibility fixes to system test

See merge request isc-projects/bind9!4311
2020-10-27 14:25:34 +00:00
Michal Nowak
175f03f5db
Replace a seq invocation with a shell loop
seq is not portable.  Use a while loop instead to make the "dnssec"
system test script POSIX-compatible.

(cherry picked from commit c0c4c024c6)
2020-10-27 12:26:03 +01:00
Michal Nowak
3e937a8c7c
Get rid of bashisms in string comparisons
The double equal sign ('==') is a Bash-specific string comparison
operator.  Ensure the single equal sign ('=') is used in all POSIX shell
scripts in the system test suite in order to retain their portability.

(cherry picked from commit 481dfb9671)
2020-10-27 12:26:03 +01:00
Michal Nowak
fee71478c5 Merge branch 'mnowak/add-stress-test-to-CI-v9_16' into 'v9_16'
[v9_16] Add "stress" tests to GitLab CI

See merge request isc-projects/bind9!4307
2020-10-26 17:11:56 +00:00
Michal Nowak
06f721fdc5
Add "stress" tests to GitLab CI
Run "stress" tests for scheduled pipelines and pipelines created for
tags.  These tests were previously only performed manually (as part of
pre-release testing of each new BIND version).  Their purpose is to
detect memory leaks and potential performance issues.

As the run time of each "stress" test itself is set to 1 hour, set the
GitLab CI job timeout to 2 hours in order to account for the extra time
needed to set the test up and gather its results.

(cherry picked from commit 39305411e8)
2020-10-26 18:04:53 +01:00
Michal Nowak
8643bc7a7a Merge branch 'mnowak/openbsd-fix-gdb-in-system-test-v9_16' into 'v9_16'
[v9_16] Fix system test backtrace generation on OpenBSD

See merge request isc-projects/bind9!4304
2020-10-26 15:58:13 +00:00
Michal Nowak
659feff963
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)
2020-10-26 15:01:52 +01:00
Mark Andrews
e657199696 Merge branch '2226-tsan-error-in-dispatch-c-v9_16' into 'v9_16'
Hold qid->lock when calling deref_portentry() as

See merge request isc-projects/bind9!4302
2020-10-23 20:56:48 +00:00
Mark Andrews
2a5d2c55aa Hold qid->lock when calling deref_portentry() as
socket_search() need portentry to be unchanging.

    WARNING: ThreadSanitizer: data race
    Write of size 8 at 0x000000000001 by thread T1 (mutexes: write M1):
    #0 deref_portentry lib/dns/dispatch.c:630
    #1 deactivate_dispsocket lib/dns/dispatch.c:861
    #2 udp_recv lib/dns/dispatch.c:1105
    #3 udp_exrecv lib/dns/dispatch.c:1028
    #4 dispatch lib/isc/task.c:1152
    #5 run lib/isc/task.c:1344
    #6 <null> <null>

    Previous read of size 8 at 0x000000000001 by thread T2 (mutexes: write M1, write M2):
    #0 socket_search lib/dns/dispatch.c:661
    #1 get_dispsocket lib/dns/dispatch.c:744
    #2 dns_dispatch_addresponse lib/dns/dispatch.c:3120
    #3 resquery_send lib/dns/resolver.c:2467
    #4 fctx_query lib/dns/resolver.c:2217
    #5 fctx_try lib/dns/resolver.c:4245
    #6 fctx_timeout lib/dns/resolver.c:4570
    #7 dispatch lib/isc/task.c:1152
    #8 run lib/isc/task.c:1344
    #9 <null> <null>

(cherry picked from commit 5c253c416d)
2020-10-24 07:14:47 +11:00
Mark Andrews
0a5ab32400 Merge branch '2215-dns_zoneflag_noixfr-is-misnamed-v9_16' into 'v9_16'
DNS_ZONEFLAG_NOIXFR should be DNS_ZONEFLG_NOIXFR

See merge request isc-projects/bind9!4300
2020-10-23 13:53:25 +00:00
Mark Andrews
2e264a4ae2 DNS_ZONEFLAG_NOIXFR should be DNS_ZONEFLG_NOIXFR
(cherry picked from commit 3a044444bd)
2020-10-24 00:26:25 +11:00
Evan Hunt
dd9e8a313b Merge branch '2221-netmgr-fixes-from-unit-testing-v9_16' into 'v9_16'
Fix the problems found when writing the unit test for netmgr

See merge request isc-projects/bind9!4294
2020-10-22 22:53:04 +00:00
Evan Hunt
b252fd5fd8 CHANGES
(cherry picked from commit 58a0e95976)
2020-10-22 15:01:12 -07:00
Ondřej Surý
bca8604bf3 Fix the data race when read-writing sock->active by using cmpxchg
(cherry picked from commit 8797e5efd5)
2020-10-22 15:00:07 -07:00
Ondřej Surý
74378ea4f4 Ignore and don't log ISC_R_NOTCONNECTED from uv_accept()
When client disconnects before the connection can be accepted, the named
would log a spurious log message:

    error: Accepting TCP connection failed: socket is not connected

We now ignore the ISC_R_NOTCONNECTED result code and log only other
errors

(cherry picked from commit 5ef71c420f)
2020-10-22 15:00:07 -07:00
Ondřej Surý
301e4145de Fix the isc_nm_closedown() to actually close the pending connections
1. The isc__nm_tcp_send() and isc__nm_tcp_read() was not checking
   whether the socket was still alive and scheduling reads/sends on
   closed socket.

2. The isc_nm_read(), isc_nm_send() and isc_nm_resumeread() have been
   changed to always return the error conditions via the callbacks, so
   they always succeed.  This applies to all protocols (UDP, TCP and
   TCPDNS).

(cherry picked from commit f7c82e406e)
2020-10-22 15:00:00 -07:00
Ondřej Surý
5547657bce Fix the way tcp_send_direct() is used
There were two problems how tcp_send_direct() was used:

1. The tcp_send_direct() can return ISC_R_CANCELED (or translated error
   from uv_tcp_send()), but the isc__nm_async_tcpsend() wasn't checking
   the error code and not releasing the uvreq in case of an error.

2. In isc__nm_tcp_send(), when the TCP send is already in the right
   netthread, it uses tcp_send_direct() to send the TCP packet right
   away.  When that happened the uvreq was not freed, and the error code
   was returned to the caller.  We need to return ISC_R_SUCCESS and
   rather use the callback to report an error in such case.

(cherry picked from commit 6af08d1ca6)
2020-10-22 14:59:01 -07:00
Ondřej Surý
e0ebd02b9c Detach the sock->server in uv_close() callback, not before
(cherry picked from commit d72bc3eb52)
2020-10-22 14:59:01 -07:00
Ondřej Surý
e18f3fd003 Explicitly stop reading before closing the nmtcpsocket
When closing the socket that is actively reading from the stream, the
read_cb() could be called between uv_close() and close callback when the
server socket has been already detached hence using sock->statichandle
after it has been already freed.

(cherry picked from commit 97b33e5bde)
2020-10-22 14:59:01 -07:00
Witold Kręcicki
63e923364f Proper handling of socket references in case of TCP conn failure.
(cherry picked from commit ff0a336d52)
2020-10-22 14:59:00 -07:00
Witold Kręcicki
b4e27a075a Don't crash if isc_uv_export returns an error in accept_connection.
isc_uv_export can return an error - e.g. EMFILE (from dup), handle this
nicely.

(cherry picked from commit ae9a6befa8)
2020-10-22 14:59:00 -07:00