nsswitch/wb_common.c: don't operate on a stale wb_global_ctx.key
authorStefan Metzmacher <metze@samba.org>
Fri, 8 Sep 2023 07:56:47 +0000 (09:56 +0200)
committerJule Anger <janger@samba.org>
Mon, 18 Sep 2023 15:59:16 +0000 (15:59 +0000)
commit7d04c32ed7eaacfa7e233a7cc141344041c20fc5
tree9f60cd4a977961213bb1619a002bd725cd05afd8
parent9c10f828dfbf44ec09a2ddf9d98bc5248bf5cf22
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 91b30a7261e6455d3a4f31728c23e4849e3945b9)
nsswitch/wb_common.c
selftest/knownfail.d/b15464_testcase [deleted file]