2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-28 13:08:06 +00:00

42936 Commits

Author SHA1 Message Date
Ondřej Surý
30d4939382
Move the call_rcu_thread explicit create and shutdown to isc_loop
When isc__thread_initialize() is called from a library constructor, it
could be called before we fork the main process.  This happens with
named, and then we have the call_rcu_thread attached to the pre-fork
process and not the post-fork process, which means that the initial
process will never shutdown, because there's noone to tell it so.

Move the isc__thread_initialize() and isc__thread_shutdown() to the
isc_loop unit where we call it before creating the extra thread and
after joining all the extra threads respectively.
2025-04-16 12:30:14 +02:00
Ondřej Surý
ed8421f405 chg: dev: Reduce QPDB_VIRTUAL to 10 seconds
The QPDB_VIRTUAL value was introduced to allow the clients (presumably
ns_clients) that has been running for some time to access the cached
data that was valid at the time of its inception.  The default value
of 5 minutes is way longer than longevity of the ns_client object as
the resolver will give up after 2 minutes.

Reduce the value to 10 seconds to accomodate to honour the original
more closely, but still allow some leeway for clients that started some
time in the past.

Our measurements show that even setting this value to 0 has no
statistically significant effect, thus the value of 10 seconds should be
on the safe side.

Merge branch 'ondrej/reduce-QPDB_VIRTUAL' into 'main'

See merge request isc-projects/bind9!10309
2025-04-16 10:19:50 +00:00
Ondřej Surý
6ed821beb4
Reduce QPDB_VIRTUAL to 10 seconds
The *DB_VIRTUAL value was introduced to allow the clients (presumably
ns_clients) that has been running for some time to access the cached
data that was valid at the time of its inception.  The default value
of 5 minutes is way longer than longevity of the ns_client object as
the resolver will give up after 2 minutes.

Reduce the value to 10 seconds to accomodate to honour the original
more closely, but still allow some leeway for clients that started some
time in the past.

Our measurements show that even setting this value to 0 has no
statistically significant effect, thus the value of 10 seconds should be
on the safe side.
2025-04-16 11:21:38 +02:00
Nicki Křížek
dfe755a5d6 chg: pkg: Use jinja2 templates in system tests
`python-jinja2` is now required to run system tests.

Related #4938

Merge branch 'nicki/replace-setup-sh-files-with-jinja2-templates' into 'main'

See merge request isc-projects/bind9!9588
2025-04-15 15:28:39 +00:00
Nicki Křížek
543ba8da5a Require python-jinja2 for system tests
Many of the system tests now use jinja2 template engine. Adding jinja2
as a hard dependency is preferable than potentially silently skipping
many system tests.
2025-04-15 16:46:54 +02:00
Nicki Křížek
e0f0c557a0 Replace selected setup.sh system test files
These setup.sh scripts only do templating and copying files. Both of
these can be replaced with either jinja templates, or using plain files.
Since each test invocation creates its own temporary directory, copying
files to ensure a "clean" state is no longer necessary.

In cases where named writes some content to the files, a jinja template
can be used instead of a plain file to avoid an artifact check which
would detect a change to a git-tracked file.
2025-04-15 14:11:20 +02:00
Nicki Křížek
a9f1b8d6a6 Replace the trivial setup.sh system test files
All these setup files only use copy_setports function which can be done
with jinja2 templates instead -- simply by renaming the .in files to
.j2, without any other changes. The pytest runner will render these
templates during test setup without any need for an additional script.
2025-04-15 14:11:16 +02:00
Mark Andrews
79c50d4538 fix: usr: Return DNS COOKIE and NSID with BADVERS
This change allows the client to identify the server that returns the
BADVERS and to provide a DNS SERVER COOKIE to be included in the
resend of the request.

Closes #5235

Merge branch '5235-return-the-server-cookie-when-returning-badvers' into 'main'

See merge request isc-projects/bind9!10334
2025-04-15 03:11:01 +00:00
Mark Andrews
f69b4bc5e0 Check DNS COOKIE, NSID and BADVERS
DNS COOKIE and NSID should also be being processed when returning
BADVERS.  Check that this has actually occured by looking for the
cookie and nsid in the response.
2025-04-15 02:38:37 +00:00
Mark Andrews
44140cad3b Extract and send server cookie with BADVERS retry
A BADVERS response can also include EDNS SERVER COOKIE.  Extract
that from the OPT record and use it when resending the request.
2025-04-15 02:38:37 +00:00
Mark Andrews
0d9cab1555 Process NSID and DNS COOKIE options when returning BADVERS
This will help identify the broken server if we happen to break
EDNS version negotiation.  It will also help protect the client
from spoofed BADVERSION responses.
2025-04-15 02:38:37 +00:00
Matthijs Mekking
488f0f876d chg: doc: Add a note on pregenerating keys
With `dnssec-policy` you can pregenerate keys and if they are eligible, rather than creating a new key, a key is selected from the pregenerated keys. A key is eligible if it is unused, i.e it has no key timing metadata set.

Merge branch 'matthijs-clarify-pregenerating-keys' into 'main'

See merge request isc-projects/bind9!10385
2025-04-14 15:01:49 +00:00
Matthijs Mekking
9880bfff63 Add a note about pregenarating keys for key rolls
With dnssec-policy you can pregenerate keys and if they are eligible,
rather than creating a new key, a key is selected from the pregenerated
keys. A key is eligible if it is unused, i.e it has no key timing
metadata set.
2025-04-14 14:27:25 +00:00
Michal Nowak
b3ee5dc8f7 fix: test: Fix check_pid() in runtime system test on FreeBSD
The original check_pid() always returned 0 on FreeBSD, even if the
process was still running. This makes the "verifying that named checks
for conflicting named processes" check fail on FreeBSD with TSAN.

Merge branch 'mnowak/fix-runtime-pid-check' into 'main'

See merge request isc-projects/bind9!10373
2025-04-14 10:56:13 +00:00
Michal Nowak
6acaca963d Fix check_pid() in runtime system test on FreeBSD
The original check_pid() always returned 0 on FreeBSD, even if the
process was still running. This makes the "verifying that named checks
for conflicting named processes" check fail on FreeBSD with TSAN.
2025-04-14 10:48:31 +00:00
Michał Kępień
b82d434be2 chg: test: Use isctest.asyncserver in the "forward" test
Replace the custom DNS servers used in the "forward" system test with new
code based on the isctest.asyncserver module.

For ans6, instead of configuring the responses to send at runtime, set
them up when the server is started.  Make sure the server supports
toggling response sending at runtime to enable simulating forwarder
timeouts as required by one of the checks.

For ans11, put most of the responses to be provided by that server into
a zone file, only retaining code modifying zone-based answers in the
form of a response handler, to improve code readability.  Use explicit
domain names instead of variables as that server only handles a single
domain and fixed strings improve readability in this case.  Make sure
the server supports toggling response sending at runtime to enable
simulating forwarder timeouts as required by one of the checks.

Migrate sendcmd() and its uses to the new way of sending control queries
to custom servers used in system tests.

Depends on !10339

Merge branch 'michal/forward-asyncserver' into 'main'

See merge request isc-projects/bind9!10340
2025-04-11 14:51:14 +00:00
Michał Kępień
23bc8430d9
Use isctest.asyncserver in the "forward" test
Replace the custom DNS servers used in the "forward" system test with
new code based on the isctest.asyncserver module.

For ans6, instead of configuring the responses to send at runtime, set
them up when the server is started.  Make sure the server supports
toggling response sending at runtime to enable simulating forwarder
timeouts as required by one of the checks.

For ans11, put most of the responses to be provided by that server into
a zone file, only retaining code modifying zone-based answers in the
form of a response handler, to improve code readability.  Use explicit
domain names instead of variables as that server only handles a single
domain and fixed strings improve readability in this case.  Make sure
the server supports toggling response sending at runtime to enable
simulating forwarder timeouts as required by one of the checks.

Migrate sendcmd() and its uses to the new way of sending control queries
to custom servers used in system tests.
2025-04-11 09:18:50 -05:00
Michał Kępień
b47be755db new: test: Add support for control commands to isctest.asyncserver
Some BIND 9 system tests need to dynamically change custom server
behavior at runtime.  Existing custom servers typically use a separate
TCP socket for listening to control commands, which mimics what `named`
does, but adds extra complexity to the custom server's networking code
for no gain (given the purpose at hand).  There is also no common way of
performing typical runtime actions (like toggling response dropping)
across all custom servers.

Instead of listening on a separate TCP socket in `asyncserver.py`, make
it detect DNS queries to a "magic" domain (`_control.`) on the same port
as the one it uses for receiving "production" DNS traffic.  This enables
query/response logging code to be reused for control traffic, clearly
denotes behavior changes in packet captures, facilitates implementing
commonly used features as reusable chunks of code (by making them "own"
distinct subdomains of the control domain), voids the need for separate
tools sending control commands, and enables using DNS facilities for
returning information to the user (e.g. RCODE for status codes, TXT
records for additional information, etc.).

Merge branch 'michal/asyncserver-control-commands' into 'main'

See merge request isc-projects/bind9!10339
2025-04-11 14:17:22 +00:00
Michał Kępień
92b39f8352
Add control command for toggling response dropping
Implement a reusable control command that makes it possible to
dynamically disable/enable sending responses to clients.  This is a
typical use case for custom DNS servers employed in various BIND 9
system tests.
2025-04-11 09:14:57 -05:00
Michał Kępień
a7e1de716b
Implement control query handling
Some BIND 9 system tests need to dynamically change custom server
behavior at runtime.  Existing custom servers typically use a separate
TCP socket for listening to control commands, which mimics what named
does, but adds extra complexity to the custom server's networking code
for no gain (given the purpose at hand).  There is also no common way of
performing typical runtime actions (like toggling response dropping)
across all custom servers.

Instead of listening on a separate TCP socket in asyncserver.py, make it
detect DNS queries to a "magic" domain ("_control.") on the same port as
the one it uses for receiving "production" DNS traffic.  This enables
query/response logging code to be reused for control traffic, clearly
denotes behavior changes in packet captures, facilitates implementing
commonly used features as reusable chunks of code (by making them "own"
distinct subdomains of the control domain), voids the need for separate
tools sending control commands, and enables using DNS facilities for
returning information to the user (e.g. RCODE for status codes, TXT
records for additional information, etc.).
2025-04-11 09:14:57 -05:00
Michał Kępień
5e71fd081e
Add debug logs for response handler matching
With multiple and/or dynamically managed response handlers at play, it
becomes useful for debugging purposes to know which handler (if any) was
used for preparing each response sent by the server.  Add debug logs
providing that information.  Make class name the default string
representation of each response handler to prettify logs.
2025-04-11 09:14:57 -05:00
Michał Kępień
92b072bff4
Make response handler management more flexible
Extend AsyncDnsServer.install_response_handler() so that the provided
response handler can be inserted at the beginning of the handler list.
This enables installing a response handler that takes priority over all
previously installed handlers.

Add a new method, AsyncDnsServer.uninstall_response_handler(), which
enables removing a previously installed response handler.

Together, these two methods provide full control over the response
handler list at runtime.
2025-04-11 09:14:57 -05:00
Michał Kępień
8cb51d4c2b
Avoid global namespace pollution
Add a main() function to all custom servers based on isctest.asyncserver
and move server startup code there.  This prevents redefining variables
from outer scope in custom server code as it evolves.
2025-04-11 09:14:57 -05:00
Michał Kępień
fd0290c919
Gracefully handle invalid queries
Prevent custom servers based on asyncserver.py from exiting prematurely
due to unhandled exceptions raised as a result of attempting to parse
invalid queries sent by clients.
2025-04-11 09:14:57 -05:00
Michał Kępień
715bd1b667
Fix Python 3.6 StreamWriter compatibility issue
The StreamWriter.wait_closed() method was introduced in Python 3.7, so
attempting to use it with Python 3.6 raises an exception.  This has not
been noticed before because awaiting StreamWriter.wait_closed() is the
last action taken for each TCP connection and unhandled exceptions were
not causing the scripts based on AsyncServer to exit prematurely until
the previous commit.

As per Python documentation [1], awaiting StreamWriter.wait_closed()
after calling StreamWriter.close() is recommended, but not mandatory, so
try to use it if it is available, without taking any fallback action in
case it isn't.

[1] https://docs.python.org/3.13/library/asyncio-stream.html#asyncio.StreamWriter.close
2025-04-11 09:14:57 -05:00
Michał Kępień
ec4c92d9d5
Ensure uncaught exceptions kill custom servers
Uncaught exceptions raised by tasks running on event loops are not
handled by Python's default exception handler, so they do not cause
scripts to die immediately with a non-zero exit code.  Set up an
exception handler for AsyncServer code that makes any uncaught exception
the result of the Future that the top-level coroutine awaits.  This
ensures that any uncaught exceptions cause scripts based on AsyncServer
to immediately exit with an error, enabling the system test framework to
fail tests in which custom servers encounter unforeseen problems.
2025-04-11 09:14:57 -05:00
Matthijs Mekking
b571c084db chg: test: Rewrite kasp system test to pytest (1)
Move test code that can be reused for the kasp pytest-based system test.

Merge branch 'matthijs-pytest-rewrite-kasp-system-test-1' into 'main'

See merge request isc-projects/bind9!10252
2025-04-10 21:17:49 +00:00
Matthijs Mekking
0a6cc42914 Update _check_dnskeys function
In the kasp system test there are cases that the SyncPublish is not
set, nor it is required to do so. Update the _check_dnskeys function
accordingly.
2025-04-10 15:44:31 -05:00
Matthijs Mekking
9cb287afa0 Add support for TSIG in isctest.kasp
For some kasp test we are going to need TSIG based queries to
differentiate between views.
2025-04-10 15:44:31 -05:00
Matthijs Mekking
12e57eb222 Introduce pytest check_next_key_event, get_keyids
For the kasp tests we need a new utility that can retrieve a list of
Keys from a given directory, belonging to a specific zone. This is
'keydir_to_keylist' and is the replacement of 'kasp.sh:get_keyids()'.

'next_key_event_eqauls' is a method to check when the next key event is
scheduled, needed for the rollover tests, and is the equivalent of shell
script 'check_next_key_event'.
2025-04-10 15:44:31 -05:00
Matthijs Mekking
44ff63a50d Introduce pytest verify_keys and check_keytimes
This commit introduces replacements for the 'check_keys' and
'check_keytimes' from the shell test library. 'check_keys' is renamed
to 'verify_keys' because it does not assert.

For that, we introduce more functions for the class Key. The
'match_properties' function is used in 'verify_keys' to see if a set of
KeyProperties match the Key. This speficially ignores timing metadata.
The function resembles what is in 'kasp.sh:check_key()'.

The 'match_timingmetadata' function is used in 'check_keytimes' to see
if the timing metadata of a set of KeyProperties match the Key. The
values are checked in all three key files (except if the private key is
not available (set with properties["private"]), or if it is a legacy key
(set with properties["legacy"]).

An additional check function is added, to check if the key relationships
are set correctly. It follows a similar pattern as 'check_keytimes'. If
"Predecessor" and/or "Successor" are expected to be set in the state
file, this function checks so, and also verifies that they are not set
if they should not be.
2025-04-10 15:44:31 -05:00
Matthijs Mekking
97f6b7ad11 Update class Key
Because we want to check the metadata in all three files, a new
value in the Key class is added: 'privatefile'. The 'get_metadata'
function is adapted so that we can also check metadata in other files.

Introduce methods to easily retrieve the TTL and public DNSKEY record
from the keyfile.

When checking if the CDS is equal to the expected value, use the DNSKEY
TTL instead of hardcoded 3600.
2025-04-10 15:31:21 -05:00
Matthijs Mekking
0b9fbca18e Introduce class KeyProperties
In isctest.kasp, introduce a new class 'KeyProperties' that can be used
to check if a Key matches expected properties. Properties are for the
time being divided in three parts: 'properties' that contain some
attributes of the expected properties (such as are we dealing with a
legacy key, is the private key available, and other things that do not
fit the metadata exactly), 'metadata' that contains expected metadata
(such as 'Algorithm', 'Lifetime', 'Length'), and 'timing', which is
metadata of the class KeyTimingMetadata.

The 'default()' method fills in the expected properties for the default
DNSSEC policy.

The 'set_expected_times()' sets the expected timing metadata, derived
from when the key was created. This method can take an offset to push
the expected timing metadata a duration in the future or back into the
past. If 'pregenerated=True', derive the expected timing metadata from
the 'Publish' metadata derived from the keyfile, rather than from the
'Created' metadata.

The calculations in the 'Ipub', 'IpubC' and 'Iret' methods are derived
from RFC 7583 DNSSEC Key Rollover Timing Considerations.
2025-04-10 15:31:21 -05:00
Matthijs Mekking
ee8e9f1ded Move test code that can be reused to isctest
This is the first step of converting the kasp system test to pytest.
Well, perhaps not the first, because earlier the ksr system test was
already converted to pytest and then the `isctest/kasp.py` library
was already introduced. Lots of this code can be reused for the kasp
pytest code.

First of all, 'check_file_contents_equal' is moved out of the ksr test
and into the 'check' library. This feels the most appropriate place
for this function to be reused in other tests. Then, 'keystr_to_keylist'
is moved to the 'kasp' library.

Introduce two new methods that are unused in this point of time, but
we are going to need them for the kasp system test. 'zone_contains'
will be used to check if a signature exists in the zonefile. This way
we can tell whether the signature has been reused or refreshed.
'file_contents_contain' will be used to check if the comment and public
DNSKEY record in the keyfile is correct.
2025-04-10 15:31:21 -05:00
Nicki Křížek
21c7ec182a chg: doc: Set up version for BIND 9.21.8
Merge branch 'nicki/set-up-version-for-bind-9.21.8' into 'main'

See merge request isc-projects/bind9!10378
2025-04-10 13:32:31 +00:00
Nicki Křížek
603d4f4e7b Update BIND version to 9.21.8-dev 2025-04-10 15:21:13 +02:00
Mark Andrews
ecbae71fe9 fix: usr: check_private failed to account for the length byte before the OID
In PRIVATEOID keys, the key data begins with a length byte followed 
by an ASN.1 object identifier that indicates the cryptographic algorithm 
to use. Previously, the length byte was not accounted for when 
checking the contents of keys and signatures, which could have led
to interoperability problems with any zones signed using PRIVATEOID.
This has been fixed.

Closes #5270

Merge branch '5270-fix-check-private' into 'main'

See merge request isc-projects/bind9!10372
2025-04-09 20:05:54 +00:00
Mark Andrews
ca7355b7d0 Fix OID check for PRIVATEOID keys and signatures
We were failing to account for the length byte before the OID.
See RFC 4034.

   Algorithm number 254 is reserved for private use and will never be
   assigned to a specific algorithm.  The public key area in the DNSKEY
   RR and the signature area in the RRSIG RR begin with an unsigned
   length byte followed by a BER encoded Object Identifier (ISO OID) of
   that length.  The OID indicates the private algorithm in use, and the
   remainder of the area is whatever is required by that algorithm.
   Entities should only use OIDs they control to designate their private
   algorithms.
2025-04-03 23:00:16 +11:00
Ondřej Surý
bc8799ee17 fix: usr: Nested DNS validation could cause assertion failure
When multiple nested DNS validations were destroyed out of order,
the EDE context could be freed before all EDE codes were copied,
which could cause an assertion failure. This has been fixed.

Closes #5213

Merge branch '5213-use-dns_ede_copy-in-dns_validator' into 'main'

See merge request isc-projects/bind9!10365
2025-04-02 16:41:57 +00:00
Ondřej Surý
2988ebae21
Don't copy EDE codes if source is same as destination
If the nested DNS validator ends up in the same fetch because of the
loops, the code could be copying the EDE codes from the same source EDE
context as the destination EDE context.  Skip copying the EDE codes if
the source and the destination is the same.
2025-04-02 18:06:52 +02:00
Ondřej Surý
fe48290140
Don't pass edectx from fetch_and_forget
Pass NULL as edectx for the fetch_and_forget() fetches as nobody
is reading the EDE contexts and it can mess the main client buffer.
2025-04-02 17:38:31 +02:00
Ondřej Surý
d7593196a1
Add static ede context into each validator layer
Instead of passing the edectx from the fetchctx into all subvalidators,
make the ede context ownership explict for dns_resolver_createfetch()
callers, and copy the ede result codes from the children validators to
the parent when finishing the validation process.
2025-04-02 17:32:50 +02:00
Alessio Podda
b407f9caa8 chg: dev: Remove zero initialization of large buffers
Profiles show that an high amount of CPU time spent in memset.
By removing zero initalization of certain large buffers we improve
performance in certain authoritative workloads.

Closes #5159

Merge branch '5159-do-not-zero-qp-search-buffers' into 'main'

See merge request isc-projects/bind9!10058
2025-04-02 15:00:34 +00:00
alessio
4017a40b1d Remove zero initialization of large buffers
Profiles show that an high amount of CPU time spent in memset.
By removing zero initalization of certain large buffers we improve
performance in certain authoritative workloads.
2025-04-02 16:24:31 +02:00
Andoni Duarte
9d4bf476d8 chg: ci: Update issue closing regex in dangerfile.py
Update issue regex in danger file
    
The regular expression in `dangerfile.py` has been updated to match
the one in GitLab and bind9-qa (isc-projects/bind9-qa!41), i.e.
https://docs.gitlab.com/user/project/issues/managing_issues/#default-closing-pattern.

Merge branch 'andoni/update-issue-regex-in-danger-file' into 'main'

See merge request isc-projects/bind9!10361
2025-04-02 13:38:40 +00:00
Andoni Duarte Pintado
5298d0fcb8 Update issue closing regex in dangerfile.py
Update the regular expression used for extracting references to GitLab
issues closed by a given merge request so that it is identical to the
one used by GitLab [1].

See also isc-projects/bind9-qa!41

[1] https://docs.gitlab.com/user/project/issues/managing_issues/#default-closing-pattern
2025-04-02 13:34:05 +00:00
Arаm Sаrgsyаn
3571c70203 chg: nil: Suppress FreeBSD-specific TSAN false-positive lock-order-inversion
TSAN reports a lock-order-inversion (potential deadlock) issue in
`add_trace_entry()`.

While it is true that in one case a lock in the `isc_mem_t` structure is
locked first, and then a lock in the `FILE` structure is locked second,
and in the the second case it is the other way around, this isn't an
issue, because those are `FILE` structures for totally different files,
used in different parts of the code.

Closes #5266

Merge branch '5266-freebsd-suppress-tsan-lock-order-inversion-false-positive' into 'main'

See merge request isc-projects/bind9!10355
2025-04-02 12:33:00 +00:00
Aram Sargsyan
33dff63cbb Suppress FreeBSD-specific TSAN false-positive lock-order-inversion
TSAN reports a lock-order-inversion (potential deadlock) issue in
add_trace_entry():

    WARNING: ThreadSanitizer: lock-order-inversion (potential deadlock)
      Cycle in lock order graph: M0001 (0x000000000001) => M0002 (0x000000000002) => M0001
      Mutex M0002 acquired here while holding mutex M0001 in main thread:
        #0 _pthread_mutex_lock /usr/src/contrib/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:1342:3
        #1 add_trace_entry lib/isc/mem.c:210:2
        #2 isc__mem_get lib/isc/mem.c:606:2
        #3 isc_buffer_allocate lib/isc/./include/isc/buffer.h:1080:23
        #4 pushandgrow lib/isc/lex.c:321:3
        #5 isc_lex_gettoken lib/isc/lex.c:445:22
        #6 cfg_gettoken lib/isccfg/parser.c:3490:11
        #7 cfg_parse_mapbody lib/isccfg/parser.c:2230:3
        #8 cfg_parse_obj lib/isccfg/parser.c:247:11
        #9 parse2 lib/isccfg/parser.c:628:11
        #10 cfg_parse_file lib/isccfg/parser.c:668:11
        #11 load_configuration bin/named/server.c:8069:13
        #12 run_server bin/named/server.c:9518:2
        #13 isc__async_cb lib/isc/async.c:110:3
        #14 uv__async_io /tmp/libuv-1.50.0/src/unix/async.c:208:5
        #15 uv__io_poll /tmp/libuv-1.50.0/src/unix/kqueue.c:369:9
        #16 uv_run /tmp/libuv-1.50.0/src/unix/core.c:460:5
        #17 loop_thread lib/isc/loop.c:327:6
        #18 thread_body lib/isc/thread.c:89:8
        #19 isc_thread_main lib/isc/thread.c:124:2
        #20 isc_loopmgr_run lib/isc/loop.c:513:2
        #21 main bin/named/main.c:1469:2
      Mutex M0001 previously acquired by the same thread here:
        #0 _pthread_mutex_lock /usr/src/contrib/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:1342:3
        #1 _flockfile /usr/src/lib/libc/stdio/_flock_stub.c:72:3
        #2 cfg_gettoken lib/isccfg/parser.c:3490:11
        #3 cfg_parse_mapbody lib/isccfg/parser.c:2230:3
        #4 cfg_parse_obj lib/isccfg/parser.c:247:11
        #5 parse2 lib/isccfg/parser.c:628:11
        #6 cfg_parse_file lib/isccfg/parser.c:668:11
        #7 load_configuration bin/named/server.c:8069:13
        #8 run_server bin/named/server.c:9518:2
        #9 isc__async_cb lib/isc/async.c:110:3
        #10 uv__async_io /tmp/libuv-1.50.0/src/unix/async.c:208:5
        #11 uv__io_poll /tmp/libuv-1.50.0/src/unix/kqueue.c:369:9
        #12 uv_run /tmp/libuv-1.50.0/src/unix/core.c:460:5
        #13 loop_thread lib/isc/loop.c:327:6
        #14 thread_body lib/isc/thread.c:89:8
        #15 isc_thread_main lib/isc/thread.c:124:2
        #16 isc_loopmgr_run lib/isc/loop.c:513:2
        #17 main bin/named/main.c:1469:2
      Mutex M0001 acquired here while holding mutex M0002 in main thread:
        #0 _pthread_mutex_lock /usr/src/contrib/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:1342:3
        #1 _flockfile /usr/src/lib/libc/stdio/_flock_stub.c:72:3
        #2 print_active lib/isc/mem.c:629:3
        #3 isc_mem_stats lib/isc/mem.c:694:2
        #4 main bin/named/main.c:1498:4
      Mutex M0002 previously acquired by the same thread here:
        #0 _pthread_mutex_lock /usr/src/contrib/llvm-project/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp:1342:3
        #1 isc_mem_stats lib/isc/mem.c:668:2
        #2 main bin/named/main.c:1498:4
    SUMMARY: ThreadSanitizer: lock-order-inversion (potential deadlock) lib/isc/mem.c:210:2 in add_trace_entry

In the first stack frame ('M0001'->'M0002' lock order) cfg_gettoken()
uses flockfile() to lock 'M0001' for the 'FILE' object associated with
the configuration file (e.g. the configuration file itself and
whatever it includes, like a zone database), then it locks a memory
context mutex M0002.

In the other stack frmae ('M0002'->'M0001' lock order) isc_mem_stats()
locks a memory context mutex M0002, then it uses fprintf(), which
internally locks a 'M0001' mutex with flockfile() to write into the
'named.memstats' memory statistics file.

While it is true that in one case a lock in the 'isc_mem_t' structure is
locked first, and then a lock in the 'FILE' structure is locked second,
and in the the second case it is the other way around, this isn't an
issue, because those are 'FILE' structures for totally different files,
used in different parts of the code.

It was also manually confirmed that 'named.memstats' doesn't get
processed by cfg_gettoken(), and is used only in the second stack
frame's code flow when named is exiting.
2025-04-02 11:14:43 +00:00
Nicki Křížek
6c943c92d9 new: ci: Allow pushing branches and tags to customer git repos
For pipelines in the private repository, add an optional manual job,
which allows the current branch to be pushed into the specified
customer's git repository. This can be useful to provide patch previews
for early testing.

For tags created in a private repository, add a manual job which pushes
the created tag to all entitled customers.

Merge branch 'nicki/ci-customer-git-automation' into 'main'

See merge request isc-projects/bind9!10323
2025-04-02 11:03:30 +00:00
Nicki Křížek
378b412e94 Allow pushing branches and tags to customer git repos
For pipelines in the private repository, add an optional manual job,
which allows the current branch to be pushed into the specified
customer's git repository. This can be useful to provide patch previews
for early testing.

For tags created in a private repository, add a manual job which pushes
the created tag to all entitled customers.
2025-04-02 11:02:57 +00:00