1. 28 Jul, 2020 1 commit
  2. 04 Jun, 2020 1 commit
  3. 21 Apr, 2020 1 commit
    • Ondřej Surý's avatar
      Complete rewrite the BIND 9 build system · 978c7b2e
      Ondřej Surý authored
      The rewrite of BIND 9 build system is a large work and cannot be reasonable
      split into separate merge requests.  Addition of the automake has a positive
      effect on the readability and maintainability of the build system as it is more
      declarative, it allows conditional and we are able to drop all of the custom
      make code that BIND 9 developed over the years to overcome the deficiencies of
      autoconf + custom Makefile.in files.
      
      This squashed commit contains following changes:
      
      - conversion (or rather fresh rewrite) of all Makefile.in files to Makefile.am
        by using automake
      
      - the libtool is now properly integrated with automake (the way we used it
        was rather hackish as the only official way how to use libtool is via
        automake
      
      - the dynamic module loading was rewritten from a custom patchwork to libtool's
        libltdl (which includes the patchwork to support module loading on different
        systems internally)
      
      - conversion of the unit test executor from kyua to automake parallel driver
      
      - conversion of the system test executor from custom make/shell to automake
        parallel driver
      
      - The GSSAPI has been refactored, the custom SPNEGO on the basis that
        all major KRB5/GSSAPI (mit-krb5, heimdal and Windows) implementations
        support SPNEGO mechanism.
      
      - The various defunct tests from bin/tests have been removed:
        bin/tests/optional and bin/tests/pkcs11
      
      - The text files generated from the MD files have been removed, the
        MarkDown has been designed to be readable by both humans and computers
      
      - The xsl header is now generated by a simple sed command instead of
        perl helper
      
      - The <irs/platform.h> header has been removed
      
      - cleanups of configure.ac script to make it more simpler, addition of multiple
        macros (there's still work to be done though)
      
      - the tarball can now be prepared with `make dist`
      
      - the system tests are partially able to run in oot build
      
      Here's a list of unfinished work that needs to be completed in subsequent merge
      requests:
      
      - `make distcheck` doesn't yet work (because of system tests oot run is not yet
        finished)
      
      - documentation is not yet built, there's a different merge request with docbook
        to sphinx-build rst conversion that needs to be rebased and adapted on top of
        the automake
      
      - msvc build is non functional yet and we need to decide whether we will just
        cross-compile bind9 using mingw-w64 or fix the msvc build
      
      - contributed dlz modules are not included neither in the autoconf nor automake
      978c7b2e
  4. 25 Mar, 2020 1 commit
    • Ondřej Surý's avatar
      Fix 'Dereference of null pointer' from scan-build-10 · ddd0d356
      Ondřej Surý authored
      These are mostly false positives, the clang-analyzer FAQ[1] specifies
      why and how to fix it:
      
      > The reason the analyzer often thinks that a pointer can be null is
      > because the preceding code checked compared it against null. So if you
      > are absolutely sure that it cannot be null, remove the preceding check
      > and, preferably, add an assertion as well.
      
      The 4 warnings reported are:
      
      dnssec-cds.c:781:4: warning: Access to field 'base' results in a dereference of a null pointer (loaded from variable 'buf')
                              isc_buffer_availableregion(buf, &r);
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /builds/isc-projects/bind9/lib/isc/include/isc/buffer.h:996:36: note: expanded from macro 'isc_buffer_availableregion'
                                         ^
      /builds/isc-projects/bind9/lib/isc/include/isc/buffer.h:821:16: note: expanded from macro 'ISC__BUFFER_AVAILABLEREGION'
                      (_r)->base = isc_buffer_used(_b);              \
                                   ^~~~~~~~~~~~~~~~~~~
      /builds/isc-projects/bind9/lib/isc/include/isc/buffer.h:152:29: note: expanded from macro 'isc_buffer_used'
              ((void *)((unsigned char *)(b)->base + (b)->used)) /*d*/
                                         ^~~~~~~~~
      1 warning generated.
      
      --
      
      byname_test.c:308:34: warning: Access to field 'fwdtable' results in a dereference of a null pointer (loaded from variable 'view')
                      RUNTIME_CHECK(dns_fwdtable_add(view->fwdtable, dns_rootname,
                                                     ^~~~~~~~~~~~~~
      /builds/isc-projects/bind9/lib/isc/include/isc/util.h:318:52: note: expanded from macro 'RUNTIME_CHECK'
                                                         ^~~~
      /builds/isc-projects/bind9/lib/isc/include/isc/error.h:50:21: note: expanded from macro 'ISC_ERROR_RUNTIMECHECK'
              ((void)(ISC_LIKELY(cond) ||  \
                                 ^~~~
      /builds/isc-projects/bind9/lib/isc/include/isc/likely.h:23:43: note: expanded from macro 'ISC_LIKELY'
                                                  ^
      1 warning generated.
      
      --
      
      ./rndc.c:255:6: warning: Dereference of null pointer (loaded from variable 'host')
              if (*host == '/') {
                  ^~~~~
      1 warning generated.
      
      --
      
      ./main.c:1254:9: warning: Access to field 'sctx' results in a dereference of a null pointer (loaded from variable 'named_g_server')
              sctx = named_g_server->sctx;
                     ^~~~~~~~~~~~~~~~~~~~
      1 warning generated.
      
      References:
      1. https://clang-analyzer.llvm.org/faq.html#null_pointer
      ddd0d356
  5. 11 Mar, 2020 2 commits
    • Ondřej Surý's avatar
      Improve the backtrace to print symbols when backtrace_symbols() is available · e8475918
      Ondřej Surý authored
      The previous commit removed the code related to the internal symbol
      table.  On platforms where available, we can now use backtrace_symbols()
      to print more verbose symbols table to the output.
      
      As there's now general availability of backtrace() and
      backtrace_symbols() functions (see below), the commit also removes the
      usage of glibc internals and the custom stack tracing.
      
      * backtrace(), backtrace_symbols(), and backtrace_symbols_fd() are
        provided in glibc since version 2.1.
      * backtrace(), backtrace_symbols(), and backtrace_symbols_fd() first
        appeared in Mac OS X 10.5.
      * The backtrace() library of functions first appeared in NetBSD 7.0 and
        FreeBSD 10.0.
      e8475918
    • Evan Hunt's avatar
      Remove support for internal symbol table · ad5250ff
      Evan Hunt authored
      Since we can no longer generate an internal symbol table, there
      doesn't seem to be much reason to retain the code that reads it.
      ad5250ff
  6. 09 Mar, 2020 1 commit
  7. 21 Feb, 2020 1 commit
  8. 17 Feb, 2020 1 commit
  9. 14 Feb, 2020 1 commit
  10. 13 Feb, 2020 2 commits
    • Evan Hunt's avatar
      apply the modified style · e851ed0b
      Evan Hunt authored
      e851ed0b
    • Ondřej Surý's avatar
      Use clang-tidy to add curly braces around one-line statements · 056e133c
      Ondřej Surý authored
      The command used to reformat the files in this commit was:
      
      ./util/run-clang-tidy \
      	-clang-tidy-binary clang-tidy-11
      	-clang-apply-replacements-binary clang-apply-replacements-11 \
      	-checks=-*,readability-braces-around-statements \
      	-j 9 \
      	-fix \
      	-format \
      	-style=file \
      	-quiet
      clang-format -i --style=format $(git ls-files '*.c' '*.h')
      uncrustify -c .uncrustify.cfg --replace --no-backup $(git ls-files '*.c' '*.h')
      clang-format -i --style=format $(git ls-files '*.c' '*.h')
      056e133c
  11. 12 Feb, 2020 1 commit
  12. 22 Jan, 2020 1 commit
  13. 14 Jan, 2020 1 commit
    • Witold Krecicki's avatar
      Make hazard pointers max_threads configurable at runtime. · 493b6a9f
      Witold Krecicki authored
      hp implementation requires an object for each thread accessing
      a hazard pointer. previous implementation had a hardcoded
      HP_MAX_THREAD value of 128, which failed on machines with lots of
      CPU cores (named uses 3n threads). We make isc__hp_max_threads
      configurable at startup, with the value set to 4*named_g_cpus.
      It's also important for this value not to be too big as we do
      linear searches on a list.
      493b6a9f
  14. 17 Dec, 2019 2 commits
  15. 03 Dec, 2019 1 commit
    • Ondřej Surý's avatar
      Refactor the dns_name API to use ISC_THREAD_LOCAL · 1a66aabd
      Ondřej Surý authored
      Previously, the dns_name API used isc_thread_key API for TLS, which is
      fairly complicated and requires initialization of memory contexts, etc.
      This part of code was refactored to use a ISC_THREAD_LOCAL pointer which
      greatly simplifies the whole code related to storing TLS variables.
      1a66aabd
  16. 02 Dec, 2019 1 commit
    • Michał Kępień's avatar
      Move xmlInitThreads()/xmlCleanupThreads() calls · b425b5d5
      Michał Kępień authored
      xmlInitThreads() and xmlCleanupThreads() are called from within
      named_statschannels_configure() and named_statschannels_shutdown(),
      respectively.  Both of these functions are executed by worker threads,
      not the main named thread.  This causes ASAN to report memory leaks like
      the following one upon shutdown (as long as named is asked to produce
      any XML output over its configured statistics channels during its
      lifetime):
      
          Direct leak of 968 byte(s) in 1 object(s) allocated from:
              #0 0x7f677c249cd8 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:153
              #1 0x7f677bc1838f in xmlGetGlobalState (/usr/lib/libxml2.so.2+0xa838f)
      
      The data mentioned in the above report is a libxml2 state structure
      stored as thread-specific data.  Such chunks of memory are automatically
      released (by a destructor passed to pthread_key_create() by libxml2)
      whenever a thread that allocated a given chunk exits.  However, if
      xmlCleanupThreads() is called by a given thread before it exits, the
      destructor will not be invoked (due to xmlCleanupThreads() calling
      pthread_key_delete()) and ASAN will report a memory leak.  Thus,
      xmlInitThreads() and xmlCleanupThreads() must not be called from worker
      threads.  Since xmlInitThreads() must be called on Windows in order for
      libxml2 to work at all, move xmlInitThreads() and xmlCleanupThreads()
      calls to the main named thread (which does not produce any XML output
      itself) in order to prevent the memory leak from being reported by ASAN.
      b425b5d5
  17. 29 Nov, 2019 1 commit
    • Michał Kępień's avatar
      Fix logging long named command lines · 009df30f
      Michał Kępień authored
      The saved_command_line buffer in bin/named/main.c is 8192 bytes long.
      The size of libisc's internal logging buffer (defined by the value of
      the LOG_BUFFER_SIZE constant in lib/isc/log.c) is also 8192 bytes.
      Since the buffer containing the ellipsis is passed as the last argument
      to isc_log_write() and the buffer containing the potentially trimmed
      named command line (saved_command_line) is passed as the second argument
      in the same isc_log_write() call, it may happen that saved_command_line
      will exhaust all available space in libisc's internal logging buffer, in
      which case the ellipsis will be elided from the output.
      
      Make saved_command_line 4096 bytes long as that value is arguably also
      large enough for any reasonable use case and at the same time it ensures
      ellipsis will always be printed for excessively long named command
      lines.
      009df30f
  18. 23 Nov, 2019 1 commit
  19. 07 Nov, 2019 2 commits
    • Evan Hunt's avatar
      convert ns_client and related objects to use netmgr · 53f0b6c3
      Evan Hunt authored
      - ns__client_request() is now called by netmgr with an isc_nmhandle_t
        parameter. The handle can then be permanently associated with an
        ns_client object.
      - The task manager is paused so that isc_task events that may be
        triggred during client processing will not fire until after the netmgr is
        finished with it. Before any asynchronous event, the client MUST
        call isc_nmhandle_ref(client->handle), to prevent the client from
        being reset and reused while waiting for an event to process. When
        the asynchronous event is complete, isc_nmhandle_unref(client->handle)
        must be called to ensure the handle can be reused later.
      - reference counting of client objects is now handled in the nmhandle
        object.  when the handle references drop to zero, the client's "reset"
        callback is used to free temporary resources and reiniialize it,
        whereupon the handle (and associated client) is placed in the
        "inactive handles" queue.  when the sysstem is shutdown and the
        handles are cleaned up, the client's "put" callback is called to free
        all remaining resources.
      - because client allocation is no longer handled in the same way,
        the '-T clienttest' option has now been removed and is no longer
        used by any system tests.
      - the unit tests require wrapping the isc_nmhandle_unref() function;
        when LD_WRAP is supported, that is used. otherwise we link a
        libwrap.so interposer library and use that.
      53f0b6c3
    • Evan Hunt's avatar
      optionally associate a netmgr with a task manager when creating · 36ee4303
      Evan Hunt authored
      When a task manager is created, we can now specify an `isc_nm`
      object to associate with it; thereafter when the task manager is
      placed into exclusive mode, the network manager will be paused.
      36ee4303
  20. 05 Nov, 2019 1 commit
  21. 26 Sep, 2019 1 commit
    • Michał Kępień's avatar
      Prevent unbuffered stderr I/O on Windows · c72da349
      Michał Kępień authored
      Make stderr fully buffered on Windows to improve named performance when
      it is logging to stderr, which happens e.g. in system tests.  Note that:
      
        - line buffering (_IOLBF) is unavailable on Windows,
      
        - fflush() is called anyway after each log message gets written to the
          default stderr logging channels created by libisc.
      c72da349
  22. 12 Sep, 2019 1 commit
  23. 04 Sep, 2019 1 commit
  24. 30 Aug, 2019 1 commit
  25. 25 Jun, 2019 2 commits
  26. 30 May, 2019 1 commit
  27. 29 May, 2019 1 commit
  28. 14 Mar, 2019 1 commit
  29. 08 Mar, 2019 1 commit
  30. 06 Feb, 2019 2 commits
  31. 15 Nov, 2018 3 commits
  32. 09 Nov, 2018 1 commit