2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-02 23:55:27 +00:00

Remove isc__tls_setfatalmode() function and the calls

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.
This commit is contained in:
Ondřej Surý
2024-02-07 15:25:13 +01:00
parent 76997983fd
commit 0c18ed7ec6
11 changed files with 2 additions and 27 deletions

View 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);
}

View 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);
}

View 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) {

View 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);
}

View 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);
}

View 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);
}

View 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);
}

View 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);
}

View 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);
}

View File

@@ -615,6 +615,3 @@ isc__tls_shutdown(void);
void
isc__tls_setdestroycheck(bool check);
void
isc__tls_setfatalmode(void);

View 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);
}