]> git.ipfire.org Git - thirdparty/bind9.git/log
thirdparty/bind9.git
5 years agoI was told to leave it alone, but I have this thing called OCD, you see 2433-lockless-mempool
Ondřej Surý [Wed, 3 Mar 2021 12:47:56 +0000 (13:47 +0100)] 
I was told to leave it alone, but I have this thing called OCD, you see

5 years agoWIP
Ondrej Sury [Fri, 26 Feb 2021 07:33:12 +0000 (08:33 +0100)] 
WIP

5 years agoDerp. Fix missing constant post rename
Ondřej Surý [Fri, 26 Feb 2021 07:20:23 +0000 (08:20 +0100)] 
Derp. Fix missing constant post rename

5 years agoFixed a bug cause Rupert said to
Ondřej Surý [Thu, 25 Feb 2021 17:02:41 +0000 (18:02 +0100)] 
Fixed a bug cause Rupert said to

5 years agoWIP
Ondrej Sury [Thu, 25 Feb 2021 16:52:30 +0000 (17:52 +0100)] 
WIP

5 years agoWIP: Max the mempool lockless on the hotpath
Ondřej Surý [Thu, 25 Feb 2021 16:11:57 +0000 (17:11 +0100)] 
WIP: Max the mempool lockless on the hotpath

5 years agoWIP: Remove freemax from mempool
Ondřej Surý [Thu, 25 Feb 2021 14:40:24 +0000 (15:40 +0100)] 
WIP: Remove freemax from mempool

5 years agoRemove the fillcount from the isc_mempool API
Ondřej Surý [Thu, 25 Feb 2021 13:54:12 +0000 (14:54 +0100)] 
Remove the fillcount from the isc_mempool API

Previously, the fillcount could be used to indicate how many elements
would be preallocated every time the memory would be empty.  This would
result in bursty allocations when the mempool would be drained.

For more smooth performance, we allocate the new pool items only as
needed.  In the future, we could consider changing the
isc_mempool_create() function to take an initial number of pre-allocated
items on the pool, so the bursty allocation happens only on the pool
creation.

5 years agoCleanup the isc_mempool_get() calls
Ondřej Surý [Wed, 24 Feb 2021 21:47:08 +0000 (22:47 +0100)] 
Cleanup the isc_mempool_get() calls

Use the semantic patch to cleanup the error handling from
isc_mempool_get() since it can't fail now and it will always return a
valid chunk of memory.

5 years agoAdd semantic patch for never failing isc_mempool_get()
Ondřej Surý [Wed, 24 Feb 2021 21:44:38 +0000 (22:44 +0100)] 
Add semantic patch for never failing isc_mempool_get()

The isc_mempool_get() could never fail now, thus we add a semantic patch
for cleaning up the error paths from the calls where previously we had
to check if the return value was not NULL.

5 years agoRemove the maximum allocation limit from the isc_mempool
Ondřej Surý [Wed, 24 Feb 2021 21:38:37 +0000 (22:38 +0100)] 
Remove the maximum allocation limit from the isc_mempool

The only place where the limits on the maximum number of allocated items
from the pool was the dns_dispatch where we already have different
limits in place.

As an example the maximum number of buffers is guarded by:

    if (disp->mgr->buffers >= DNS_DISPATCH_MAXBUFFERS) {
            UNLOCK(&disp->mgr->buffer_lock);
            return (NULL);
    }

but then at the same time we were limiting the maximum number of items
we can get from the disp->bpool.

By removing the maximum allocation limit from the isc_mempool API, we
can simplify the logic in many places as the isc_mempool_get() would
never fail now and it would always return a chunk of memory.

5 years agoMerge branch 'ondrej/call-isc__initialize-shutdown-from-DllMain' into 'main'
Ondřej Surý [Tue, 2 Mar 2021 07:48:19 +0000 (07:48 +0000)] 
Merge branch 'ondrej/call-isc__initialize-shutdown-from-DllMain' into 'main'

Call isc__initialize()/isc__shutdown() from win32 DllMain

See merge request isc-projects/bind9!4759

5 years agoCall isc__initialize()/isc__shutdown() from win32 DllMain
Ondřej Surý [Mon, 1 Mar 2021 13:21:05 +0000 (14:21 +0100)] 
Call isc__initialize()/isc__shutdown() from win32 DllMain

Call the libisc isc__initialize() constructor and isc__shutdown()
destructor from DllMain instead of having duplicate code between
those and DllMain() code.

5 years agoMerge branch 'ondrej/improve-mempool-AddressSanitizer-integration' into 'main'
Evan Hunt [Fri, 26 Feb 2021 18:26:28 +0000 (18:26 +0000)] 
Merge branch 'ondrej/improve-mempool-AddressSanitizer-integration' into 'main'

Improve allocation-deallocation tracking with AddressSanitizer

See merge request isc-projects/bind9!4748

5 years agoAdd mempool get/put tracking with AddressSanitizer
Ondřej Surý [Thu, 25 Feb 2021 10:08:34 +0000 (11:08 +0100)] 
Add mempool get/put tracking with AddressSanitizer

When AddressSanitizer is in use, disable the internal mempool
implementation and redirect the isc_mempool_get to isc_mem_get
(and similarly for isc_mempool_put).  This is the method recommended
by the AddressSanitizer authors for tracking allocations and
deallocations instead of custom poison/unpoison code (see
https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning).

5 years agoMerge branch '2396-add-thread-trampoline-for-thread-accounting' into 'main'
Ondřej Surý [Fri, 26 Feb 2021 12:44:15 +0000 (12:44 +0000)] 
Merge branch '2396-add-thread-trampoline-for-thread-accounting' into 'main'

Resolve "BIND 9.16 unit tests failing reliably on x86_64 NUMA machines"

Closes #2396

See merge request isc-projects/bind9!4687

5 years agoAdd CHANGES note for GL #2396
Ondřej Surý [Tue, 16 Feb 2021 20:43:04 +0000 (21:43 +0100)] 
Add CHANGES note for GL #2396

5 years agoChange the isc_thread_self() return type to uintptr_t
Ondřej Surý [Tue, 16 Feb 2021 18:54:04 +0000 (19:54 +0100)] 
Change the isc_thread_self() return type to uintptr_t

The pthread_self(), thrd_current() or GetCurrentThreadId() could
actually be a pointer, so we should rather convert the value into
uintptr_t instead of unsigned long.

5 years agoUse globally assigned thread_id in the isc_hp API
Ondřej Surý [Tue, 16 Feb 2021 15:02:51 +0000 (16:02 +0100)] 
Use globally assigned thread_id in the isc_hp API

Convert the isc_hp API to use the globally available isc_tid_v instead
of locally defined tid_v.  This should solve most of the problems on
machines with many number of cores / CPUs.

5 years agoAdd isc_trampoline API to have simple accounting around threads
Ondřej Surý [Tue, 16 Feb 2021 14:57:39 +0000 (15:57 +0100)] 
Add isc_trampoline API to have simple accounting around threads

The current isc_hp API uses internal tid_v variable that gets
incremented for each new thread using hazard pointers.  This tid_v
variable is then used as a index to global shared table with hazard
pointers state.  Since the tid_v is only incremented and never
decremented the table could overflow very quickly if we create set of
threads for short period of time, they finish the work and cease to
exist.  Then we create identical set of threads and so on and so on.
This is not a problem for a normal `named` operation as the set of
threads is stable, but the problematic place are the unit tests where we
test network manager or other APIs (task, timer) that create threads.

This commits adds a thin wrapper around any function called from
isc_thread_create() that adds unique-but-reusable small digit thread id
that can be used as index to f.e. hazard pointer tables.  The trampoline
wrapper ensures that the thread ids will be reused, so the highest
thread_id number doesn't grow indefinitely when threads are created and
destroyed and then created again.  This fixes the hazard pointer table
overflow on machines with many cores. [GL #2396]

5 years agoMerge branch '2503-stale-answer-client-timeout-crash' into 'main'
Matthijs Mekking [Thu, 25 Feb 2021 11:03:13 +0000 (11:03 +0000)] 
Merge branch '2503-stale-answer-client-timeout-crash' into 'main'

Resolve "New stale-answer-client-timeout crashes BIND 9.16 and 9.17"

Closes #2503

See merge request isc-projects/bind9!4714

5 years agoAdd CHANGES and release notes for GL #2503
Matthijs Mekking [Thu, 18 Feb 2021 15:22:32 +0000 (16:22 +0100)] 
Add CHANGES and release notes for GL #2503

5 years agoDon't servfail on staleonly lookups
Matthijs Mekking [Mon, 22 Feb 2021 11:08:49 +0000 (12:08 +0100)] 
Don't servfail on staleonly lookups

When a staleonly lookup doesn't find a satisfying answer, it should
not try to respond to the client.

This is not true when the initial lookup is staleonly (that is when
'stale-answer-client-timeout' is set to 0), because no resolver fetch
has been created at this point. In this case continue with the lookup
normally.

5 years agoDon't allow recursion on staleonly lookups
Matthijs Mekking [Thu, 18 Feb 2021 15:09:41 +0000 (16:09 +0100)] 
Don't allow recursion on staleonly lookups

Fix a crash that can happen in the following scenario:

A client request is received. There is no data for it in the cache,
(not even stale data). A resolver fetch is created as part of
recursion.

Some time later, the fetch still hasn't completed, and
stale-answer-client-timeout is triggered. A staleonly lookup is
started. It will also find no data in the cache.

So 'query_lookup()' will call 'query_gotanswer()' with ISC_R_NOTFOUND,
so this will call 'query_notfound()' and this will start recursion.

We will eventually end up in 'ns_query_recurse()' and that requires
the client query fetch to be NULL:

    REQUIRE(client->query.fetch == NULL);

If the previously started fetch is still running this assertion
fails.

The crash is easily prevented by not requiring recursion for
staleonly lookups.

Also remove a redundant setting of the staleonly flag at the end of
'query_lookup_staleonly()' before destroying the query context.

Add a system test to catch this case.

5 years agoMerge branch '2498-nsec3-dynamic-update-dnssec-policy' into 'main'
Matthijs Mekking [Thu, 25 Feb 2021 09:49:29 +0000 (09:49 +0000)] 
Merge branch '2498-nsec3-dynamic-update-dnssec-policy' into 'main'

Resolve "Regression in BIND 9.16.10, DNSSEC fails due to improper NSEC3 creation witihin named"

Closes #2498

See merge request isc-projects/bind9!4739

5 years agoAdd changes and notes for [#2498]
Matthijs Mekking [Wed, 24 Feb 2021 09:23:14 +0000 (10:23 +0100)] 
Add changes and notes for [#2498]

5 years agoFix dnssec-policy NSEC3 on dynamic zones
Matthijs Mekking [Wed, 24 Feb 2021 08:35:06 +0000 (09:35 +0100)] 
Fix dnssec-policy NSEC3 on dynamic zones

When applying dnssec-policy on a dynamic zone (e.g. that allows Dynamic
Updates), the NSEC3 parameters were put on the queue, but they were
not being processed (until a reload of the zone or reconfiguration).

Process the NSEC3PARAM queue on zone postload when handling a
dynamic zone.

5 years agoAdd tests for NSEC3 on dynamic zones
Matthijs Mekking [Tue, 23 Feb 2021 14:35:47 +0000 (15:35 +0100)] 
Add tests for NSEC3 on dynamic zones

GitLab issue #2498 is a bug report on NSEC3 with dynamic zones. Tests
for it in the nsec3 system test directory were missing.

5 years agoMerge branch '2507-cid-320483-api-usage-errors-lock' into 'main'
Mark Andrews [Thu, 25 Feb 2021 05:54:20 +0000 (05:54 +0000)] 
Merge branch '2507-cid-320483-api-usage-errors-lock' into 'main'

Resolve "CID 320483:  API usage errors  (LOCK)"

Closes #2507

See merge request isc-projects/bind9!4721

5 years agoAddress unbalanced lock/unlock
Mark Andrews [Sun, 21 Feb 2021 21:44:31 +0000 (08:44 +1100)] 
Address unbalanced lock/unlock

Also address race between reading and testing mpctx->allocated
and incrementing mpctx->allocated.

5 years agoMerge branch '2519-disable-assertion-in-DLL_THREAD_ATTACH-DLL_THREAD_DETACH' into...
Ondřej Surý [Wed, 24 Feb 2021 08:03:16 +0000 (08:03 +0000)] 
Merge branch '2519-disable-assertion-in-DLL_THREAD_ATTACH-DLL_THREAD_DETACH' into 'main'

Disable safe-guard assertion in DLL_THREAD_ATTACH/DLL_THREAD_DETACH

Closes #2519

See merge request isc-projects/bind9!4738

5 years agoDisable safe-guard assertion in DLL_THREAD_ATTACH/DLL_THREAD_DETACH
Ondřej Surý [Wed, 24 Feb 2021 05:55:36 +0000 (06:55 +0100)] 
Disable safe-guard assertion in DLL_THREAD_ATTACH/DLL_THREAD_DETACH

The BIND 9 libraries on Windows define DllMain() optional entry point
into a dynamic-link library (DLL).  When the system starts or terminates
a process or thread, it calls the entry-point function for each loaded
DLL using the first thread of the process.

When the DLL is being loaded into the virtual address space of the
current process as a result of the process starting up, we make a call
to DisableThreadLibraryCalls() which should disable the
DLL_THREAD_ATTACH and DLL_THREAD_DETACH notifications for the specified
dynamic-link library (DLL).

This seems not be the case because we never check the return value of
the DisableThreadLibraryCalls() call, and it could in fact fail.  The
DisableThreadLibraryCalls() function fails if the DLL specified by
hModule has active static thread local storage, or if hModule is an
invalid module handle.

In this commit, we remove the safe-guard assertion put in place for the
DLL_THREAD_ATTACH and DLL_THREAD_DETACH events and we just ignore them.
BIND 9 doesn't create/destroy enough threads for it actually to make any
difference, and in fact we do use static thread local storage in the
code.

5 years agoMerge branch 'marka-placeholder' into 'main'
Mark Andrews [Tue, 23 Feb 2021 22:53:34 +0000 (22:53 +0000)] 
Merge branch 'marka-placeholder' into 'main'

add placeholder

See merge request isc-projects/bind9!4737

5 years agoadd placeholder
Mark Andrews [Tue, 23 Feb 2021 22:49:27 +0000 (09:49 +1100)] 
add placeholder

5 years agoMerge branch '2446-query-c-5430-16-runtime-error' into 'main'
Michal Nowak [Tue, 23 Feb 2021 15:43:50 +0000 (15:43 +0000)] 
Merge branch '2446-query-c-5430-16-runtime-error' into 'main'

Initialize checknames field in dns_view_create()

Closes #2446

See merge request isc-projects/bind9!4706

5 years agoInitialize checknames field in dns_view_create()
Michal Nowak [Mon, 22 Feb 2021 12:50:11 +0000 (13:50 +0100)] 
Initialize checknames field in dns_view_create()

The 'checknames' field wasn't initialized in dns_view_create(), but it
should otherwise AddressSanitizer identifies the following runtime error
in query_test.c.

    runtime error: load of value 190, which is not a valid value for type '_Bool'

5 years agoRevert "Initialize checknames field in query_test.c"
Michal Nowak [Mon, 22 Feb 2021 12:40:31 +0000 (13:40 +0100)] 
Revert "Initialize checknames field in query_test.c"

This reverts commit c75484c4dff04698c183b456a6cc85f951264e75.

5 years agoInitialize checknames field in query_test.c
Michal Nowak [Thu, 18 Feb 2021 13:49:23 +0000 (14:49 +0100)] 
Initialize checknames field in query_test.c

'checknames' field of struct dns_view is not initialized by
dns_view_create(). ASAN identified this as runtime error:

    runtime error: load of value 190, which is not a valid value for type '_Bool'

5 years agoMerge branch 'mnowak/alpine-3.13' into 'main'
Michal Nowak [Tue, 23 Feb 2021 14:45:19 +0000 (14:45 +0000)] 
Merge branch 'mnowak/alpine-3.13' into 'main'

Add Alpine Linux 3.13

See merge request isc-projects/bind9!4724

5 years agoAdd Alpine Linux 3.13
Michal Nowak [Mon, 22 Feb 2021 10:59:47 +0000 (11:59 +0100)] 
Add Alpine Linux 3.13

5 years agoMerge branch 'mnowak/pairwise-pict-keep-stderr' into 'main'
Michal Nowak [Tue, 23 Feb 2021 14:25:38 +0000 (14:25 +0000)] 
Merge branch 'mnowak/pairwise-pict-keep-stderr' into 'main'

Do not remove stderr from pict output

See merge request isc-projects/bind9!4727

5 years agoDo not remove stderr from pict output
Michal Nowak [Tue, 23 Feb 2021 10:30:08 +0000 (11:30 +0100)] 
Do not remove stderr from pict output

Removing stderr from the pict tool serves no purpose and drops valuable
information, we might use when debugging failed pairwise CI job, such
as:

    Input Error: A parameter names must be unique

5 years agoMerge branch '2508-cid-320481-null-pointer-dereferences-reverse_inull' into 'main'
Mark Andrews [Tue, 23 Feb 2021 13:04:38 +0000 (13:04 +0000)] 
Merge branch '2508-cid-320481-null-pointer-dereferences-reverse_inull' into 'main'

Resolve "CID 320481:  Null pointer dereferences  (REVERSE_INULL)"

Closes #2508

See merge request isc-projects/bind9!4722

5 years agoSilence CID 320481: Null pointer dereferences
Mark Andrews [Sun, 21 Feb 2021 22:28:37 +0000 (09:28 +1100)] 
Silence CID 320481: Null pointer dereferences

    *** CID 320481:  Null pointer dereferences  (REVERSE_INULL)
    /bin/tests/wire_test.c: 261 in main()
    255      process_message(input);
    256      }
    257      } else {
    258      process_message(input);
    259      }
    260
       CID 320481:  Null pointer dereferences  (REVERSE_INULL)
       Null-checking "input" suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
    261      if (input != NULL) {
    262      isc_buffer_free(&input);
    263      }
    264
    265      if (printmemstats) {
    266      isc_mem_stats(mctx, stdout);

5 years agoMerge branch '2493-cid-281450-dereference-before-null-check-reverse_inull' into ...
Mark Andrews [Tue, 23 Feb 2021 12:40:56 +0000 (12:40 +0000)] 
Merge branch '2493-cid-281450-dereference-before-null-check-reverse_inull' into 'main'

Resolve "CID 281450: Dereference before null check (REVERSE_INULL)"

Closes #2493

See merge request isc-projects/bind9!4684

5 years agoSilence CID 281450: Dereference before null check
Mark Andrews [Tue, 16 Feb 2021 05:15:25 +0000 (16:15 +1100)] 
Silence CID 281450: Dereference before null check

remove redundant 'inst != NULL' test

    162cleanup:

    CID 281450 (#1 of 1): Dereference before null check (REVERSE_INULL)
    check_after_deref: Null-checking inst suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
    163        if (result != ISC_R_SUCCESS && inst != NULL) {
    164                plugin_destroy((void **)&inst);
    165        }

5 years agoMerge branch '2492-304936-dereference-before-null-check' into 'main'
Mark Andrews [Tue, 23 Feb 2021 11:57:29 +0000 (11:57 +0000)] 
Merge branch '2492-304936-dereference-before-null-check' into 'main'

Resolve "CID 304936: Dereference before null check"

Closes #2492

See merge request isc-projects/bind9!4683

5 years agoSilence CID 304936 Dereference before null check
Mark Andrews [Tue, 16 Feb 2021 05:05:56 +0000 (16:05 +1100)] 
Silence CID 304936 Dereference before null check

Removed redundant 'listener != NULL' check.

    1191cleanup:

    CID 304936 (#1 of 1): Dereference before null check (REVERSE_INULL)
    check_after_deref: Null-checking listener suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
    1192        if (listener != NULL) {
    1193                isc_refcount_decrement(&listener->refs);
    1194                listener->exiting = true;
    1195                free_listener(listener);
    1196        }

5 years agoMerge branch '2408-dnssec-policy-purge-keys' into 'main'
Matthijs Mekking [Tue, 23 Feb 2021 09:37:56 +0000 (09:37 +0000)] 
Merge branch '2408-dnssec-policy-purge-keys' into 'main'

Resolve "kasp: Purge deleted keys"

Closes #2408

See merge request isc-projects/bind9!4665

5 years agoAdd changes and notes for [#2408]
Matthijs Mekking [Tue, 9 Feb 2021 13:42:05 +0000 (14:42 +0100)] 
Add changes and notes for [#2408]

5 years agoMinor kasp test fixes
Matthijs Mekking [Tue, 9 Feb 2021 13:35:46 +0000 (14:35 +0100)] 
Minor kasp test fixes

Two minor fixes in the kasp system test:

1. A wrong comment in ns3/setup.sh (we are subtracting 2 hours, not
   adding them).
2. 'get_keyids' used bad parameters "$1" "$2" when 'check_numkeys'
   failed. Also, 'check_numkeys' can use $DIR, $ZONE, and $NUMKEYS
   directly, no need to pass them.

5 years agoTest purge-keys option
Matthijs Mekking [Tue, 9 Feb 2021 13:33:44 +0000 (14:33 +0100)] 
Test purge-keys option

Add some more zones to the kasp system test to test the 'purge-keys'
option. Three zones test that the predecessor key files are removed
after the purge keys interval, one test checks that the key files
are retained if 'purge-keys' is disabled. For that, we change the
times to 90 days in the past (the default value for 'purge-keys').

5 years agoPurge keys implementation
Matthijs Mekking [Mon, 8 Feb 2021 14:15:57 +0000 (15:15 +0100)] 
Purge keys implementation

On each keymgr run, we now also check if key files can be removed.
The 'purge-keys' interval determines how long keys should be retained
after they have become completely hidden.

Key files should not be removed if it has a state that is set to
something else then HIDDEN, if purge-keys is 0 (disabled), if
the key goal is set to OMNIPRESENT, or if the key is unused (a key is
unused if no timing metadata set, and no states are set or if set,
they are set to HIDDEN).

If the last changed timing metadata plus the purge-keys interval is
in the past, the key files may be removed.

Add a dst_key_t variable 'purge' to signal that the key file should
not be written to file again.

5 years agoAdd purge-keys config option
Matthijs Mekking [Mon, 8 Feb 2021 11:02:19 +0000 (12:02 +0100)] 
Add purge-keys config option

Add a new option 'purge-keys' to 'dnssec-policy' that will purge key
files for deleted keys. The option determines how long key files
should be retained prior to removing the corresponding files from
disk.

If set to 0, the option is disabled and 'named' will not remove key
files from disk.

5 years agoMerge branch '2509-cid-281489-resource-leaks-resource_leak' into 'main'
Mark Andrews [Mon, 22 Feb 2021 22:39:23 +0000 (22:39 +0000)] 
Merge branch '2509-cid-281489-resource-leaks-resource_leak' into 'main'

Resolve "CID 281489:  Resource leaks  (RESOURCE_LEAK)"

Closes #2509

See merge request isc-projects/bind9!4723

5 years agoAddress theoretical resource leak in dns_dt_open()
Mark Andrews [Sun, 21 Feb 2021 22:44:56 +0000 (09:44 +1100)] 
Address theoretical resource leak in dns_dt_open()

dns_dt_open() is not currently called with mode dns_dtmode_unix.

    *** CID 281489:  Resource leaks  (RESOURCE_LEAK)
    /lib/dns/dnstap.c: 983 in dns_dt_open()
    977
    978      if (!dnstap_file(handle->reader)) {
    979      CHECK(DNS_R_BADDNSTAP);
    980      }
    981      break;
    982      case dns_dtmode_unix:
       CID 281489:  Resource leaks  (RESOURCE_LEAK)
       Variable "handle" going out of scope leaks the storage it points to.
    983      return (ISC_R_NOTIMPLEMENTED);
    984      default:
    985      INSIST(0);
    986      ISC_UNREACHABLE();
    987      }
    988

5 years agoMerge branch 'ondrej/add-tls_p.h-to-Makefile.am' into 'main'
Ondřej Surý [Fri, 19 Feb 2021 12:30:50 +0000 (12:30 +0000)] 
Merge branch 'ondrej/add-tls_p.h-to-Makefile.am' into 'main'

Include lib/isc/tls_p.h in release tarballs

See merge request isc-projects/bind9!4716

5 years agoInclude lib/isc/tls_p.h in release tarballs
Ondřej Surý [Fri, 19 Feb 2021 11:53:36 +0000 (12:53 +0100)] 
Include lib/isc/tls_p.h in release tarballs

The addition of lib/isc/tls_p.h to the source tree was not accounted for
in the relevant variable in lib/isc/Makefile.am and thus the former file
is not being included in release tarballs prepared using "make dist".
Fix by tweaking the libisc_la_SOURCES list in lib/isc/Makefile.am
accordingly.

5 years agoMerge branch '2504-do-not-require-libtool-in-PATH-at-build-time' into 'main'
Michał Kępień [Fri, 19 Feb 2021 12:09:48 +0000 (12:09 +0000)] 
Merge branch '2504-do-not-require-libtool-in-PATH-at-build-time' into 'main'

Do not require libtool in PATH at build time

Closes #2504

See merge request isc-projects/bind9!4715

5 years agoAdd CHANGES entry
Michał Kępień [Fri, 19 Feb 2021 10:52:56 +0000 (11:52 +0100)] 
Add CHANGES entry

5 years agoDo not require libtool in PATH at build time
Michał Kępień [Fri, 19 Feb 2021 10:52:56 +0000 (11:52 +0100)] 
Do not require libtool in PATH at build time

The build-time requirement for libtool was introduced inadvertently:

 1. Commit 1628f5865acb2d472ce4adf71fc78ac99094fa1c added a check to
    configure.ac which claims to test whether the libtool script is
    available.  There are two problems with that check:

      - it is effectively a no-op as the AC_PROG_LIBTOOL() macro always
        sets the LIBTOOL variable [1],

      - this check was intended to be performed before autoreconf is
        run, not when ./configure is run; the libtool script is supposed
        to be dynamically generated by ./configure on the build host and
        thus there is no need for a standalone libtool script to be
        installed system-wide on every host attempting to build BIND 9
        e.g. from a tarball produced by "make dist".

 2. Commit a7982d14dddb864420deb49e735f782022d1fa07 was based on the
    incorrect assumption that the AC_PROG_LIBTOOL() macro looks for the
    libtool binary in PATH and sets the LIBTOOL variable accordingly,
    which is what other AC_PROG_*() macros do.  Meanwhile, the
    AC_PROG_LIBTOOL() macro only initializes libtool for use with
    Automake.  It is not necessary for a standalone libtool script to be
    available in PATH on the build host when ./configure is run.

Do not look for libtool in PATH at build time as it prevents hosts
without a libtool script available system-wide from building BIND 9 from
source tarballs prepared using "make dist".  Note that libtool m4
macros, utilities, etc. still need to be present on a given host if
autoreconf is to be run on it.

[1] https://git.savannah.gnu.org/cgit/libtool.git/tree/m4/libtool.m4?h=v2.4.6#n89

5 years agoMerge branch '2499-a-loc-record-with-a-invalid-direction-field-triggers-an-insist...
Mark Andrews [Thu, 18 Feb 2021 22:37:41 +0000 (22:37 +0000)] 
Merge branch '2499-a-loc-record-with-a-invalid-direction-field-triggers-an-insist' into 'main'

Resolve "A LOC record with a invalid direction field triggers an INSIST"

Closes #2499

See merge request isc-projects/bind9!4704

5 years agoAdd release note for [GL #2499]
Mark Andrews [Thu, 18 Feb 2021 06:02:27 +0000 (17:02 +1100)] 
Add release note for [GL #2499]

5 years agoAdd CHANGES for [GL #2499]
Mark Andrews [Thu, 18 Feb 2021 05:59:57 +0000 (16:59 +1100)] 
Add CHANGES for [GL #2499]

5 years agoCorrectly detect when get_direction failed
Mark Andrews [Thu, 18 Feb 2021 05:57:28 +0000 (16:57 +1100)] 
Correctly detect when get_direction failed

5 years agoTest a LOC record with an invalid direction field
Mark Andrews [Thu, 18 Feb 2021 05:56:51 +0000 (16:56 +1100)] 
Test a LOC record with an invalid direction field

5 years agoMerge branch '2433-improve-memory-contention' into 'main'
Ondřej Surý [Thu, 18 Feb 2021 20:08:09 +0000 (20:08 +0000)] 
Merge branch '2433-improve-memory-contention' into 'main'

Resolve "investigate and improve lock contention around mctx"

Closes #2433

See merge request isc-projects/bind9!4659

5 years agoAdd CHANGES note for GL #2433
Ondřej Surý [Fri, 5 Feb 2021 12:39:38 +0000 (13:39 +0100)] 
Add CHANGES note for GL #2433

5 years agoUse library constructor/destructor to initialize OpenSSL
Ondřej Surý [Tue, 9 Feb 2021 16:44:40 +0000 (17:44 +0100)] 
Use library constructor/destructor to initialize OpenSSL

Instead of calling isc_tls_initialize()/isc_tls_destroy() explicitly use
gcc/clang attributes on POSIX and DLLMain on Windows to initialize and
shutdown OpenSSL library.

This resolves the issue when isc_nm_create() / isc_nm_destroy() was
called multiple times and it would call OpenSSL library destructors from
isc_nm_destroy().

At the same time, since we now have introduced the ctor/dtor for libisc,
this commit moves the isc_mem API initialization (the list of the
contexts) and changes the isc_mem_checkdestroyed() to schedule the
checking of memory context on library unload instead of executing the
code immediately.

5 years agoDisable calling DllMain() on thread creation/destruction
Ondřej Surý [Tue, 14 Jul 2020 08:52:02 +0000 (10:52 +0200)] 
Disable calling DllMain() on thread creation/destruction

Disables the DLL_THREAD_ATTACH and DLL_THREAD_DETACH notifications for
the specified dynamic-link library (DLL).  This can reduce the size of
the working set for some applications.

5 years agoFix the invalid condition variable
Ondřej Surý [Tue, 9 Feb 2021 12:25:52 +0000 (13:25 +0100)] 
Fix the invalid condition variable

Although harmless, the memmove() in tlsdns and tcpdns was guarded by a
current message length variable that was always bigger than 0 instead of
correct current buffer length remainder variable.

5 years agoMove most of the OpenSSL initialization to isc_tls
Ondřej Surý [Tue, 9 Feb 2021 12:25:46 +0000 (13:25 +0100)] 
Move most of the OpenSSL initialization to isc_tls

Since we now require both libcrypto and libssl to be initialized for
netmgr, we move all the OpenSSL initialization code except the engine
initialization to isc_tls API.

The isc_tls_initialize() and isc_tls_destroy() has been made idempotent,
so they could be called multiple time.  However when isc_tls_destroy()
has been called, the isc_tls_initialize() could not be called again.

5 years agoRemove overrun checking code from memory allocator
Ondřej Surý [Fri, 5 Feb 2021 16:18:28 +0000 (17:18 +0100)] 
Remove overrun checking code from memory allocator

The ISC_MEM_CHECKOVERRUN would add canary byte at the end of every
allocations and check whether the canary byte hasn't been changed at the
free time.  The AddressSanitizer and valgrind memory checks surpases
simple checks like this, so there's no need to actually keep the code
inside the allocator.

5 years agoModify the way we benchmark mem_{get,put}
Ondřej Surý [Fri, 5 Feb 2021 09:25:07 +0000 (10:25 +0100)] 
Modify the way we benchmark mem_{get,put}

Previously, the mem_{get,put} benchmark would pass the allocation size
as thread_create argument.  This has been now changed, so the allocation
size is stored and decremented (divided) in atomic variable and the
thread create routing is given a memory context.  This will allow to
write tests where each thread is given different memory context and do
the same for mempool benchmarking.

5 years agoDisable memory debugging features in non-developer build
Ondřej Surý [Fri, 5 Feb 2021 09:25:07 +0000 (10:25 +0100)] 
Disable memory debugging features in non-developer build

The two memory debugging features: ISC_MEM_DEFAULTFILL
(ISC_MEMFLAG_FILL) and ISC_MEM_TRACKLINES were always enabled in all
builds and the former was only disabled in `named`.

This commits disables those two features in non-developer build to make
the memory allocator significantly faster.

5 years agoMake the mempool names unconditional
Ondřej Surý [Thu, 4 Feb 2021 22:10:39 +0000 (23:10 +0100)] 
Make the mempool names unconditional

The named memory pools were default and always compiled-in.  Remove the
extra complexity by removing the #define and #ifdefs around the code.

5 years agoMake the memory and mempool counters to be stdatomic types
Ondřej Surý [Thu, 4 Feb 2021 20:56:49 +0000 (21:56 +0100)] 
Make the memory and mempool counters to be stdatomic types

This is yet another step into unlocking some parts of the memory
contexts.  All the regularly updated variables has been turned into
atomic types, so we can later remove the locks when updating various
counters.

Also unlock as much code as possible without breaking anything.

5 years agoBump the maximum number of hazard pointers in tests
Ondřej Surý [Tue, 14 Jul 2020 12:24:10 +0000 (14:24 +0200)] 
Bump the maximum number of hazard pointers in tests

On 24-core machine, the tests would crash because we would run out of
the hazard pointers.  We now adjust the number of hazard pointers to be
in the <128,256> interval based on the number of available cores.

Note: This is just a band-aid and needs a proper fix.

5 years agoRemove the extra level of indirection via isc_memmethods_t
Ondřej Surý [Thu, 4 Feb 2021 19:19:09 +0000 (20:19 +0100)] 
Remove the extra level of indirection via isc_memmethods_t

Previously, the applications using libisc would be able to override the
internal memory methods with own implementation.  This was no longer
possible, but the extra level of indirection was not removed.  This
commit removes the extra level of indirection for the memory methods and
the default_memalloc() and default_memfree().

5 years agoRemove the internal memory allocator
Ondřej Surý [Thu, 4 Feb 2021 19:11:20 +0000 (20:11 +0100)] 
Remove the internal memory allocator

The internal memory allocator had an extra code to keep a list of blocks
for small size allocation.  This would help to reduce the interactions
with the system malloc as the memory would be already allocated from the
system, but there's an extra cost associated with that - all the
allocations/deallocations must be locked, effectively eliminating any
optimizations in the system allocator targeted at multi-threaded
applications. While the isc_mem API is still using locks pretty heavily,
this is a first step into reducing the memory allocation/deallocation
contention.

5 years agoMerge branch 'mnowak/fix-feature-test-tool-location' into 'main'
Michal Nowak [Thu, 18 Feb 2021 14:43:29 +0000 (14:43 +0000)] 
Merge branch 'mnowak/fix-feature-test-tool-location' into 'main'

Use FEATURETEST variable instead of a path

See merge request isc-projects/bind9!4694

5 years agoUse FEATURETEST variable instead of a path
Michal Nowak [Wed, 17 Feb 2021 08:20:25 +0000 (09:20 +0100)] 
Use FEATURETEST variable instead of a path

feature-test tool location needs to be determined by its associated
variable; otherwise, the tool is not found on Windows:

    setup.sh: line 22: ../feature-test: No such file or directory

5 years agoMerge branch 'michal/add-a-checklist-for-handling-cves' into 'main'
Michał Kępień [Thu, 18 Feb 2021 10:16:57 +0000 (10:16 +0000)] 
Merge branch 'michal/add-a-checklist-for-handling-cves' into 'main'

Add a checklist for handling security issues

See merge request isc-projects/bind9!3950

5 years agoAdd a checklist for handling security issues
Michał Kępień [Thu, 18 Feb 2021 10:11:40 +0000 (11:11 +0100)] 
Add a checklist for handling security issues

5 years agoMerge branch 'v9_17_10-release' into 'main'
Michał Kępień [Wed, 17 Feb 2021 21:29:03 +0000 (21:29 +0000)] 
Merge branch 'v9_17_10-release' into 'main'

Merge 9.17.10 release branch

See merge request isc-projects/bind9!4699

5 years agoSet up release notes for BIND 9.17.11
Michał Kępień [Wed, 17 Feb 2021 21:25:26 +0000 (22:25 +0100)] 
Set up release notes for BIND 9.17.11

5 years agoUpdate BIND version to 9.17.10
Michał Kępień [Thu, 4 Feb 2021 09:50:11 +0000 (10:50 +0100)] 
Update BIND version to 9.17.10

5 years agoAdd a CHANGES marker
Michał Kępień [Thu, 4 Feb 2021 09:50:11 +0000 (10:50 +0100)] 
Add a CHANGES marker

5 years agoMerge branch 'michal/prepare-documentation-for-bind-9.17.10' into 'v9_17_10-release'
Michał Kępień [Thu, 4 Feb 2021 09:48:53 +0000 (09:48 +0000)] 
Merge branch 'michal/prepare-documentation-for-bind-9.17.10' into 'v9_17_10-release'

Prepare documentation for BIND 9.17.10

See merge request isc-private/bind9!237

5 years agoPrepare release notes for BIND 9.17.10
Michał Kępień [Thu, 4 Feb 2021 09:40:25 +0000 (10:40 +0100)] 
Prepare release notes for BIND 9.17.10

5 years agoAdd release note for GL #2073
Michał Kępień [Thu, 4 Feb 2021 09:40:25 +0000 (10:40 +0100)] 
Add release note for GL #2073

5 years agoReorder release notes
Michał Kępień [Thu, 4 Feb 2021 09:40:25 +0000 (10:40 +0100)] 
Reorder release notes

5 years agoTweak and reword release notes
Michał Kępień [Thu, 4 Feb 2021 09:40:25 +0000 (10:40 +0100)] 
Tweak and reword release notes

5 years agoTweak and reword recent CHANGES entries
Michał Kępień [Thu, 4 Feb 2021 09:40:25 +0000 (10:40 +0100)] 
Tweak and reword recent CHANGES entries

5 years agoUse :rfc:`<number>` references in release notes
Michał Kępień [Thu, 4 Feb 2021 09:40:25 +0000 (10:40 +0100)] 
Use :rfc:`<number>` references in release notes

5 years agoDocument the build-time requirement for nghttp2
Michał Kępień [Thu, 4 Feb 2021 09:40:25 +0000 (10:40 +0100)] 
Document the build-time requirement for nghttp2

5 years agoMerge branch 'mnowak/system-test-check-for-file-not-removed' into 'main'
Michal Nowak [Wed, 17 Feb 2021 16:08:26 +0000 (16:08 +0000)] 
Merge branch 'mnowak/system-test-check-for-file-not-removed' into 'main'

Check for "file not removed" in system test output

See merge request isc-projects/bind9!4680

5 years agoPrevent Git to expand $systest
Michal Nowak [Tue, 16 Feb 2021 10:33:58 +0000 (11:33 +0100)] 
Prevent Git to expand $systest

CentOS 8 "git status" unexpectedly expands search directory "tsig" to
also search in the "tsiggss" directory, thus incorrectly identifying
files as "not removed" in the "tsig" directory:

$ git status -su --ignored tsig
$ touch tsiggss/ns1/{named.run,named.memstats}
$ git status -su --ignored tsig
!! tsiggss/ns1/named.memstats
!! tsiggss/ns1/named.run

5 years agoClean omitted files from system tests
Michal Nowak [Mon, 15 Feb 2021 11:48:54 +0000 (12:48 +0100)] 
Clean omitted files from system tests

Any CI job:
- I:dnssec:file dnssec/ns1/trusted.keys not removed
- I:rpzrecurse:file rpzrecurse/ns3/named.run.prev not removed

system:clang:freebsd11:amd64:
- I:tkey:file tkey/ns1/named.conf-e not removed

system:gcc:sid:amd64:
- I:mirror:file mirror/ns3/_default.nzf not removed

system:gcc:xenial:amd64:
- I:rpzextra:file rpzextra/.cache/v/cache/lastfailed not removed
- I:rpzrecurse:file rpzrecurse/ns3/named.run.prev not removed
- I:shutdown:file shutdown/.cache/v/cache/lastfailed not removed

5 years agoCopy testcrypto.sh to out-of-tree directory
Michal Nowak [Mon, 15 Feb 2021 12:31:37 +0000 (13:31 +0100)] 
Copy testcrypto.sh to out-of-tree directory

System tests run in out-of-tree directory fail to find testcrypto.sh and
produce:

    /bin/bash: ../testcrypto.sh: No such file or directory