1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-06 13:18:07 +03:00

nsswitch/wb_common.c: don't operate on a stale wb_global_ctx.key

If nss_winbind is loaded into a process that uses fork multiple times
without any further calls into nss_winbind, wb_atfork_child handler
was using a wb_global_ctx.key that was no longer registered in the
pthread library, so we operated on a slot that was potentially
reused by other libraries or the main application. Which is likely
to cause memory corruption.

So we better don't call pthread_key_delete() in wb_atfork_child().

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15464

Reported-by: Krzysztof Piotr Oledzki <ole@ans.pl>
Tested-by: Krzysztof Piotr Oledzki <ole@ans.pl>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 91b30a7261)
This commit is contained in:
Stefan Metzmacher 2023-09-08 09:56:47 +02:00 committed by Jule Anger
parent 5b9b8b3158
commit 3d8e8ed159
2 changed files with 0 additions and 6 deletions

View File

@ -76,11 +76,6 @@ static void wb_atfork_child(void)
winbind_close_sock(ctx);
free(ctx);
ret = pthread_key_delete(wb_global_ctx.key);
assert(ret == 0);
wb_global_ctx.control = (pthread_once_t)PTHREAD_ONCE_INIT;
}
static void wb_thread_ctx_destructor(void *p)

View File

@ -1 +0,0 @@
^b15464_testcase.run.b15464-testcase