]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Remove isc__tls_setfatalmode() function and the calls
authorOndřej Surý <ondrej@isc.org>
Wed, 7 Feb 2024 14:25:13 +0000 (15:25 +0100)
committerOndřej Surý <ondrej@isc.org>
Thu, 8 Feb 2024 07:01:58 +0000 (08:01 +0100)
With _exit() instead of exit() in place, we don't need
isc__tls_setfatalmode() mechanism as the atexit() calls will not be
executed including OpenSSL atexit hooks.

bin/confgen/util.c
bin/delv/delv.c
bin/dig/dighost.c
bin/dnssec/dnssectool.c
bin/named/server.c
bin/nsupdate/nsupdate.c
bin/rndc/util.c
bin/tools/mdig.c
bin/tools/nsec3hash.c
lib/isc/include/isc/tls.h
lib/isc/tls.c

index 9f65ac1ccc3de25038efbb03cdb758ea0e42b34b..5d7ce509e47cdcb1b45b0b9013bbd85946880879 100644 (file)
@@ -47,6 +47,5 @@ fatal(const char *format, ...) {
        vfprintf(stderr, format, args);
        va_end(args);
        fprintf(stderr, "\n");
-       isc__tls_setfatalmode();
        _exit(EXIT_FAILURE);
 }
index 4bd00bfa9a34ce7edcffe2eefb7943c081eaaef2..c3b2d1c6f28ad278a29fd2e64eedff967fa03cc5 100644 (file)
@@ -263,7 +263,6 @@ fatal(const char *format, ...) {
        vfprintf(stderr, format, args);
        va_end(args);
        fprintf(stderr, "\n");
-       isc__tls_setfatalmode();
        _exit(EXIT_FAILURE);
 }
 
index 1f10437a4128c76f9e1abd63e9c195e69d98c840..1e2303a1af720275710aad66cc960a4f76776a28 100644 (file)
@@ -406,7 +406,6 @@ fatal(const char *format, ...) {
        vfprintf(stderr, format, args);
        va_end(args);
        fprintf(stderr, "\n");
-       isc__tls_setfatalmode();
        if (fatalexit == 0 && exitcode != 0) {
                fatalexit = exitcode;
        } else if (fatalexit == 0) {
index 34552864e66efdfca0a0dba1094cbd2d3a0ef3e4..6f5444464713e5b42e6a2e28ffc5438fe370bac8 100644 (file)
@@ -84,9 +84,6 @@ fatal(const char *format, ...) {
        if (fatalcallback != NULL) {
                (*fatalcallback)();
        }
-       isc__tls_setfatalmode();
-
-       /* Make sure that various atexit() calls are skipped */
        _exit(EXIT_FAILURE);
 }
 
index 09929237445a05d988db698a5575d5e6e113fb70..fe4c16ad60180badc8e9d57beba626ea72ebff9d 100644 (file)
@@ -10203,7 +10203,6 @@ fatal(const char *msg, isc_result_t result) {
                      NAMED_LOGMODULE_SERVER, ISC_LOG_CRITICAL,
                      "exiting (due to fatal error)");
        named_os_shutdown();
-       isc__tls_setfatalmode();
        _exit(EXIT_FAILURE);
 }
 
index bd01da7916f1213e416237db198fa77da8b7ea19..f81c1965b27ca77b53434a41a9356a2a95f48f9c 100644 (file)
@@ -279,7 +279,6 @@ fatal(const char *format, ...) {
        vfprintf(stderr, format, args);
        va_end(args);
        fprintf(stderr, "\n");
-       isc__tls_setfatalmode();
        _exit(EXIT_FAILURE);
 }
 
index 948ca87334467614727926c2f1fcd5be797d18ae..e0529aa77277d0dcfc1c8ca96f7835e396b2da2c 100644 (file)
@@ -46,6 +46,5 @@ fatal(const char *format, ...) {
        vfprintf(stderr, format, args);
        va_end(args);
        fprintf(stderr, "\n");
-       isc__tls_setfatalmode();
        _exit(EXIT_FAILURE);
 }
index 915d543691dedf25b8df891d8e3ea3131a7cd015..c1ac42978eb652471519ce4c442b1ce593ab93fc 100644 (file)
@@ -897,7 +897,6 @@ fatal(const char *format, ...) {
        vfprintf(stderr, format, args);
        va_end(args);
        fprintf(stderr, "\n");
-       isc__tls_setfatalmode();
        _exit(EXIT_FAILURE);
 }
 
index 046c8b7894e50a8640734dde16a542e2a24a174f..9d77a10d2a535a620887a21328fb69b4f16f11ab 100644 (file)
@@ -48,7 +48,6 @@ fatal(const char *format, ...) {
        vfprintf(stderr, format, args);
        va_end(args);
        fprintf(stderr, "\n");
-       isc__tls_setfatalmode();
        _exit(EXIT_FAILURE);
 }
 
index 109a7f7eab032fae74ea6e3075d57151c3665125..75ad88df46e2775be2355a9390b6266a2eb51110 100644 (file)
@@ -615,6 +615,3 @@ isc__tls_shutdown(void);
 
 void
 isc__tls_setdestroycheck(bool check);
-
-void
-isc__tls_setfatalmode(void);
index b2fca8b4591d268bf7dd48aa2f4501af6fa34753..281c09a92ea9658f80d0665df03a8d319552be56 100644 (file)
@@ -77,12 +77,6 @@ isc__tls_set_thread_id(CRYPTO_THREADID *id) {
 }
 #endif
 
-#ifdef ISC_TEST_OPENSSL_MEMORY_LEAKS
-static atomic_bool handle_fatal = false;
-#else
-static atomic_bool handle_fatal = true;
-#endif
-
 #if !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER >= 0x30000000L
 /*
  * This was crippled with LibreSSL, so just skip it:
@@ -115,7 +109,7 @@ isc__tls_free_ex(void *ptr, const char *file, int line) {
        if (ptr == NULL) {
                return;
        }
-       if (!atomic_load(&handle_fatal) || isc__tls_mctx != NULL) {
+       if (isc__tls_mctx != NULL) {
                isc__mem_free(isc__tls_mctx, ptr, 0, file, (unsigned int)line);
        }
 }
@@ -143,7 +137,7 @@ isc__tls_free_ex(void *ptr, const char *file, int line) {
        if (ptr == NULL) {
                return;
        }
-       if (!atomic_load(&handle_fatal) || isc__tls_mctx != NULL) {
+       if (isc__tls_mctx != NULL) {
                isc__mem_free(isc__tls_mctx, ptr, 0);
        }
 }
@@ -1796,8 +1790,3 @@ isc_tlsctx_set_random_session_id_context(isc_tlsctx_t *ctx) {
        RUNTIME_CHECK(
                SSL_CTX_set_session_id_context(ctx, session_id_ctx, len) == 1);
 }
-
-void
-isc__tls_setfatalmode(void) {
-       atomic_store(&handle_fatal, true);
-}