1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
samba-mirror/nsswitch
Ralph Boehme 7545e2c77b nsswitch: avoid calling pthread_getspecific() on an uninitialized key
Found by ASAN:

$ bin/stress-nss-libwbclient
...
==1639426==ERROR: AddressSanitizer: unknown-crash on address 0x7f3907d85000 at pc 0x7f3907d649fb bp 0x7ffc6545f5b0 sp 0x7ffc6545f5a8
READ of size 4 at 0x7f3907d85000 thread T0
    #0 0x7f3907d649fa in winbind_close_sock ../../nsswitch/wb_common.c:220
    #1 0x7f3907d65866 in winbind_destructor ../../nsswitch/wb_common.c:246
    #2 0x7f3907da5d3d in _dl_fini /usr/src/debug/glibc-2.35-20.fc36.x86_64/elf/dl-fini.c:142
    #3 0x7f3907241044 in __run_exit_handlers (/lib64/libc.so.6+0x41044)
    #4 0x7f39072411bf in exit (/lib64/libc.so.6+0x411bf)
    #5 0x7f3907229516 in __libc_start_call_main (/lib64/libc.so.6+0x29516)
    #6 0x7f39072295c8 in __libc_start_main_impl (/lib64/libc.so.6+0x295c8)
    #7 0x56236a2042b4 in _start (/data/git/samba/scratch3/bin/default/nsswitch/stress-nss-libwbclient+0x22b4)

Address 0x7f3907d85000 is a wild pointer inside of access range of size 0x000000000004.
SUMMARY: AddressSanitizer: unknown-crash ../../nsswitch/wb_common.c:220 in winbind_close_sock

The pthread key in wb_global_ctx.key is only initialized if
wb_thread_ctx_initialize() is called via get_wb_global_ctx() -> get_wb_thread_ctx().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>

Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jan  6 15:04:46 UTC 2023 on sn-devel-184
2023-01-06 15:04:46 +00:00
..
krb5_plugin nsswitch: explicitly mark magic krb5 plugin symbols as _PUBLIC_ 2021-11-30 15:53:34 +00:00
libwbclient nsswitch: leverage TLS if available in favour over global locking 2023-01-05 11:33:37 +00:00
tests nsswitch:tests: Use system_or_builddir_binary() for test_rfc2307_mapping 2022-12-23 14:35:31 +00:00
nsstest.c CVE-2020-25717: nsswitch/nsstest.c: Lower 'non existent uid' to make room for new accounts 2021-11-15 18:10:28 +00:00
nsstest.h nsswitch: Fix checking for config.h #define in nsstest.h 2018-12-16 21:04:10 +01:00
pam_winbind.c pam_winbind: Fix a memleak 2022-11-22 18:27:33 +00:00
pam_winbind.h pam_winbind: add new pwd_change_prompt option (defaults to off). 2021-12-16 03:05:30 +00:00
stress-nss-libwbclient.c nsswitch/stress-nss-libwbclient: also test after fork 2023-01-05 11:33:37 +00:00
wb_common.c nsswitch: avoid calling pthread_getspecific() on an uninitialized key 2023-01-06 15:04:46 +00:00
wb_reqtrans.c
wb_reqtrans.h
wbinfo.c wbinfo: Add --change-secret-at=dcname 2022-12-21 19:10:35 +00:00
winbind_client.h nsswitch: move winbindd_free_response() as inline function to winbind_struct_protocol.h 2021-11-30 15:53:34 +00:00
winbind_nss_aix.c nsswitch: ensure the attrlist_t array is large enough for a NULL sentinel 2021-07-12 15:11:42 +00:00
winbind_nss_config.h
winbind_nss_freebsd.c nsswitch: explicitly mark nss_module_register() _PUBLIC_ on FreeBSD 2021-11-30 15:53:34 +00:00
winbind_nss_hpux.h
winbind_nss_linux.c nsswitch: remove winbind_nss_mutex 2023-01-05 12:34:35 +00:00
winbind_nss_linux.h nsswitch: explicitly mark NSS_STATUS _nss_winbind_* symbols as _PUBLIC_ on Linux 2021-11-30 15:53:34 +00:00
winbind_nss_netbsd.c winbind_nss_netbsd: use WBFLAG_FROM_NSS 2018-12-22 03:11:14 +01:00
winbind_nss_netbsd.h
winbind_nss_solaris.c winbind_nss_solaris: use WBFLAG_FROM_NSS 2018-12-22 03:11:14 +01:00
winbind_nss_solaris.h nsswitch: maintain prototypes for the linux based functions only once 2018-04-03 16:41:09 +02:00
winbind_nss.h nsswitch: Fix checking for config.h #define in winbind_nss.h 2018-12-16 21:04:10 +01:00
winbind_struct_protocol.h s3:winbind: Convert InitConnection from struct based to NDR based 2022-05-19 17:51:33 +00:00
wins_freebsd.c nsswitch: explicitly mark nss_module_register() _PUBLIC_ on FreeBSD 2021-11-30 15:53:34 +00:00
wins.c nsswitch/wins: Define NETDB_* for other libc's 2022-08-08 06:33:38 +00:00
wscript_build nsswitch: reduce dependecies to private libraries and link static/builtin if possible 2021-11-30 15:53:34 +00:00
wscript_configure nss/waf: check for secmethod_table.method_{attrlist,version} for aix >= 5.2 2018-12-22 06:22:22 +01:00