1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00
samba-mirror/source3/winbindd
Volker Lendecke 2e1522f378 s3: Close the winbind client fds after forking
In an overload situation, the winbind helper child process inherits all those
hundreds of fd's which it will never talk to. Close them.

We (Christian Ambach and me) just saw a crash in libkrb5. Christian's analysis
showed that libkrb5 also does select, probably exceeding FD_SETSIZE and
crashing due to that reason. The parent winbind in theory does not do Kerberos
at all, so this should fix that problem.

The crash is interesting because the child process did not really crash.
Somewhere in glibc backtrace() is called, probably due to an assert() or some
explicit consistency check. This then somehow generates a signal probably due
to corrupted memory structures. That signal triggers Samba to again call
backtrace(). This blocks hard on a ptrace_once(). Sorry for the long backtrace
here, but this *is* interesting.

The child process blocking and not really crashing makes the situation worse:
The parent process does not get told the child has crashed and more client
sockets pile up.

This patch is intended to put some relief on this problem by closing the
majority of sockets the parent holds.

(gdb) bt
\#0  0x00002ad686a2b07b in pthread_once () from /lib64/libpthread.so.0
\#1  0x00002ad6867adf87 in backtrace () from /lib64/libc.so.6
\#2  0x00002ad683eab27c in log_stack_trace () at lib/util.c:1580
\#3  0x00002ad683eab34b in smb_panic (why=0x2ad6841c6ec3 "internal error") at lib/util.c:1481
\#4  0x00002ad683e9af3e in fault_report (sig=1) at lib/fault.c:52
\#5  sig_fault (sig=1) at lib/fault.c:75 #6  <signal handler called>
\#7  0x00002ad68673b005 in _int_malloc () from /lib64/libc.so.6
\#8  0x00002ad68673c95d in calloc () from /lib64/libc.so.6
\#9  0x00002ad684503e25 in _dl_new_object () from /lib64/ld-linux-x86-64.so.2
\#10 0x00002ad6844ffadc in _dl_map_object_from_fd () from /lib64/ld-linux-x86-64.so.2
\#11 0x00002ad684501d43 in _dl_map_object () from /lib64/ld-linux-x86-64.so.2
\#12 0x00002ad68450ac8d in dl_open_worker () from /lib64/ld-linux-x86-64.so.2
\#13 0x00002ad684506ed6 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2
\#14 0x00002ad68450a68c in _dl_open () from /lib64/ld-linux-x86-64.so.2
\#15 0x00002ad6867d0ba0 in do_dlopen () from /lib64/libc.so.6
\#16 0x00002ad684506ed6 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2
\#17 0x00002ad6867d0d07 in __libc_dlopen_mode () from /lib64/libc.so.6
\#18 0x00002ad6867adeea in init () from /lib64/libc.so.6
\#19 0x00002ad686a2b083 in pthread_once () from /lib64/libpthread.so.0
\#20 0x00002ad6867adf87 in backtrace () from /lib64/libc.so.6
\#21 0x00002ad68673285f in __libc_message () from /lib64/libc.so.6
\#22 0x00002ad68673a30f in _int_free () from /lib64/libc.so.6
\#23 0x00002ad68673a76b in free () from /lib64/libc.so.6
\#24 0x00002ad6853fe346 in krb5int_sendto () from /usr/lib64/libkrb5.so.3
\#25 0x00002ad6853fe511 in krb5_sendto_kdc () from /usr/lib64/libkrb5.so.3
\#26 0x00002ad6853df7c4 in ?? () from /usr/lib64/libkrb5.so.3
\#27 0x00002ad6853e0919 in krb5_get_init_creds () from /usr/lib64/libkrb5.so.3
\#28 0x00002ad6853e2a94 in krb5_get_init_creds_password () from /usr/lib64/libkrb5.so.3
\#29 0x00002ad684169ff1 in kerberos_kinit_password_ext (principal=0x2ad684702180 "<sanitized>", password=0x2ad6844c5bb0 "<sanitized>", time_offset=0, expire_time=0x2ad6846bf380, renew_till_time=0x0, cache_name=0x2ad6843cb3e0 "MEMORY:winbind_ccache", request_pac=false, add_netbios_addr=false, renewable_time=<value optimized out>, ntstatus=0x0) at libads/kerberos.c:223
\#30 0x00002ad68416a223 in ads_kinit_password (ads=0x2ad6846bf330) at libads/kerberos.c:327
\#31 0x00002ad68415f725 in ads_sasl_spnego_bind (ads=0x2ad6846bf330) at libads/sasl.c:812
\#32 0x00002ad68415dbc1 in ads_sasl_bind (ads=0x2ad6846bf330) at libads/sasl.c:1114
\#33 0x00002ad68415c09b in ads_connect (ads=0x2ad6846bf330) at libads/ldap.c:711
\#34 0x00002ad683e1b8f7 in ads_cached_connection (domain=0x2ad6846b07c0) at winbindd/winbindd_ads.c:124
\#35 0x00002ad683e1bc85 in sequence_number (domain=0x2ad6846b07c0, seq=0x2ad6846b0cd8) at winbindd/winbindd_ads.c:1233
\#36 0x00002ad683dffdd7 in refresh_sequence_number (domain=0x2ad6846b07c0, force=128) at winbindd/winbindd_cache.c:510
\#37 0x00002ad683e00520 in wcache_fetch (cache=<value optimized out>, domain=0x2ad6846b07c0, format=0x2ad68419901e "U/%s") at winbindd/winbindd_cache.c:638
\#38 0x00002ad683e04ac8 in query_user (domain=0x2ad6846b07c0, mem_ctx=0x2ad6846bc920, user_sid=0x7fff1d0cb8c0, info=0x7fff1d0cb810) at winbindd/winbindd_cache.c:1910
\#39 0x00002ad683df2d38 in winbindd_dual_userinfo (domain=0x2ad6846b07c0, state=0x7fff1d0cc9c0) at winbindd/winbindd_user.c:173
\#40 0x00002ad683e232e0 in fork_domain_child (child=0x2ad6846c2440) at winbindd/winbindd_dual.c:485
\#41 schedule_async_request (child=0x2ad6846c2440) at winbindd/winbindd_dual.c:319
\#42 0x00002ad683e229f2 in async_request_fail (state=0x2ad6846c1d00) at winbindd/winbindd_dual.c:214
\#43 0x00002ad683ebabec in run_events (ev=0x2ad6846aebf0, selrtn=0, read_fds=0x7fff1d0ce910, write_fds=<value optimized out>) at lib/events.c:123
\#44 0x00002ad683df08cb in process_loop (argc=<value optimized out>, argv=<value optimized out>, envp=<value optimized out>) at winbindd/winbindd.c:1113
\#45 main (argc=<value optimized out>, argv=<value optimized out>, envp=<value optimized out>) at winbindd/winbindd.c:1437

Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Thu Apr 28 12:06:12 CEST 2011 on sn-devel-104
2011-04-28 12:06:12 +02:00
..
idmap_adex s3-libads Pass a struct sockaddr_storage to cldap routines 2011-04-28 05:30:20 +02:00
idmap_hash s3-idmap: fix the build of idmap_hash on FreeBSD. 2011-03-31 00:14:01 +02:00
idmap_ad.c s3:idmap: remove the params argument from the init function 2011-03-22 22:49:56 +01:00
idmap_autorid.c s3-includes: only include system/filesys.h when needed. 2011-03-30 01:13:07 +02:00
idmap_ldap.c s3:idmap: remove the params argument from the init function 2011-03-22 22:49:56 +01:00
idmap_nss.c s3-includes: only include system/passwd.h when needed. 2011-03-30 01:13:07 +02:00
idmap_passdb.c s3-passdb: add passdb.h where needed. 2011-03-30 01:13:07 +02:00
idmap_proto.h s3-prototypes: remove protos of some dead functions. 2011-03-24 00:52:01 +01:00
idmap_rid.c s3:idmap: remove the params argument from the init function 2011-03-22 22:49:56 +01:00
idmap_rw.c s3:idmap: add abstract idmap_rw new_mapping mechanism without registering backends 2010-08-14 02:10:56 +02:00
idmap_rw.h s3:idmap: add abstract idmap_rw new_mapping mechanism without registering backends 2010-08-14 02:10:56 +02:00
idmap_tdb2.c s3:idmap_tdb2: fix build of tdb2 2011-04-04 15:57:34 +02:00
idmap_tdb.c s3-includes: only include system/filesys.h when needed. 2011-03-30 01:13:07 +02:00
idmap_util.c s3:winbindd/idmap_util.c: add my C 2011-01-03 08:34:04 +01:00
idmap.c s3: Make idmap_find_domain public 2011-04-13 14:13:25 -07:00
nss_info_template.c s3: Remove unused args from get_nss_info 2011-03-06 12:51:01 +01:00
nss_info.c s3: Remove unused args from nss_get_info 2011-03-06 12:51:01 +01:00
wb_dsgetdcname.c s3:winbind: Fork multiple children per domain 2011-01-21 13:51:27 +01:00
wb_fill_pwent.c s3:winbindd: use ndr_wbint_c.h instead of cli_wbint.h 2011-01-11 15:40:21 +01:00
wb_getgrsid.c s3:winbindd: use ndr_wbint_c.h instead of cli_wbint.h 2011-01-11 15:40:21 +01:00
wb_getpwsid.c s3:winbindd: use ndr_wbint_c.h instead of cli_wbint.h 2011-01-11 15:40:21 +01:00
wb_gettoken.c s3-passdb: use passdb headers where needed. 2011-03-30 01:13:08 +02:00
wb_gid2sid.c s3:winbindd: use ndr_wbint_c.h instead of cli_wbint.h 2011-01-11 15:40:21 +01:00
wb_group_members.c s3:winbind: Fork multiple children per domain 2011-01-21 13:51:27 +01:00
wb_lookupname.c s3:winbind: Fork multiple children per domain 2011-01-21 13:51:27 +01:00
wb_lookupsid.c s3:winbind: Fork multiple children per domain 2011-01-21 13:51:27 +01:00
wb_lookupsids.c s3: Add wb_lookupsids 2011-04-13 14:13:24 -07:00
wb_lookupuseraliases.c s3:winbind: Fork multiple children per domain 2011-01-21 13:51:27 +01:00
wb_lookupusergroups.c s3:winbind: Fork multiple children per domain 2011-01-21 13:51:27 +01:00
wb_next_grent.c s3-passdb: use passdb headers where needed. 2011-03-30 01:13:08 +02:00
wb_next_pwent.c s3-passdb: use passdb headers where needed. 2011-03-30 01:13:08 +02:00
wb_ping.c
wb_query_user_list.c s3:winbind: Fork multiple children per domain 2011-01-21 13:51:27 +01:00
wb_queryuser.c s3:winbind: Fork multiple children per domain 2011-01-21 13:51:27 +01:00
wb_seqnum.c s3:winbind: Fork multiple children per domain 2011-01-21 13:51:27 +01:00
wb_seqnums.c s3:winbindd: use ndr_wbint_c.h instead of cli_wbint.h 2011-01-11 15:40:21 +01:00
wb_sid2gid.c s3:winbindd: use ndr_wbint_c.h instead of cli_wbint.h 2011-01-11 15:40:21 +01:00
wb_sid2uid.c s3:winbindd: use ndr_wbint_c.h instead of cli_wbint.h 2011-01-11 15:40:21 +01:00
wb_uid2sid.c s3:winbindd: use ndr_wbint_c.h instead of cli_wbint.h 2011-01-11 15:40:21 +01:00
winbindd_ads.c s3-rpc_client: add and use rpc_client/rpc_client.h. 2011-04-13 22:23:59 +02:00
winbindd_allocate_gid.c s3:winbindd: use ndr_wbint_c.h instead of cli_wbint.h 2011-01-11 15:40:21 +01:00
winbindd_allocate_uid.c s3:winbindd: use ndr_wbint_c.h instead of cli_wbint.h 2011-01-11 15:40:21 +01:00
winbindd_async.c s3: Move parse_sidlist to the only calling file 2010-11-17 12:17:21 +01:00
winbindd_cache.c s3: Fix Coverity ID 1137: CONSTANT_EXPRESSION_RESULT 2011-04-01 09:35:19 +02:00
winbindd_ccache_access.c s3-ntlmssp: Remove ntlmssp_end and let the talloc hierarchy handle it. 2010-07-19 14:19:47 +10:00
winbindd_change_machine_acct.c s3:winbind: Fork multiple children per domain 2011-01-21 13:51:27 +01:00
winbindd_check_machine_acct.c s3:winbind: Fork multiple children per domain 2011-01-21 13:51:27 +01:00
winbindd_cm.c s3: Close the winbind client fds after forking 2011-04-28 12:06:12 +02:00
winbindd_cred_cache.c s3: avoid global include of ads.h. 2010-08-05 00:32:02 +02:00
winbindd_creds.c libcli/security Provide a common, top level libcli/security/security.h 2010-10-12 05:54:10 +00:00
winbindd_domain.c s3:winbind: Fork multiple children per domain 2011-01-21 13:51:27 +01:00
winbindd_dsgetdcname.c s3:winbindd: use ndr_wbint_c.h instead of cli_wbint.h 2011-01-11 15:40:21 +01:00
winbindd_dual_ndr.c s3-includes: only include ntdomain.h where needed. 2011-03-30 01:13:09 +02:00
winbindd_dual_srv.c s3: Add wbint_Sids2UnixIDs idl & implementation 2011-04-13 14:13:25 -07:00
winbindd_dual.c s3-includes: only include ntdomain.h where needed. 2011-03-30 01:13:09 +02:00
winbindd_endgrent.c
winbindd_endpwent.c
winbindd_getdcname.c s3:winbindd: use ndr_wbint_c.h instead of cli_wbint.h 2011-01-11 15:40:21 +01:00
winbindd_getgrent.c s3: Fix a getgrent crash with many groups 2010-11-03 12:58:49 +00:00
winbindd_getgrgid.c
winbindd_getgrnam.c
winbindd_getgroups.c s3-passdb: move LOOKUP_NAME_ flags to passdb where they belong to. 2011-03-30 15:14:55 +02:00
winbindd_getpwent.c
winbindd_getpwnam.c s3-passdb: move LOOKUP_NAME_ flags to passdb where they belong to. 2011-03-30 15:14:55 +02:00
winbindd_getpwsid.c libcli/security Provide a common, top level libcli/security/security.h 2010-10-12 05:54:10 +00:00
winbindd_getpwuid.c
winbindd_getsidaliases.c s3: Make parse_sidlist public 2011-04-13 14:13:24 -07:00
winbindd_getuserdomgroups.c libcli/security Provide a common, top level libcli/security/security.h 2010-10-12 05:54:10 +00:00
winbindd_getusersids.c libcli/security Provide a common, top level libcli/security/security.h 2010-10-12 05:54:10 +00:00
winbindd_gid_to_sid.c
winbindd_group.c
winbindd_idmap.c
winbindd_list_groups.c s3:winbind: Fork multiple children per domain 2011-01-21 13:51:27 +01:00
winbindd_list_users.c s3:winbind: Fork multiple children per domain 2011-01-21 13:51:27 +01:00
winbindd_locator.c
winbindd_lookupname.c
winbindd_lookuprids.c s3:winbind: Fork multiple children per domain 2011-01-21 13:51:27 +01:00
winbindd_lookupsid.c s3: state->ev is not needed in winbindd_lookupsid 2011-03-07 20:52:53 +01:00
winbindd_lookupsids.c s3: Add winbindd_lookupsids 2011-04-13 14:13:24 -07:00
winbindd_misc.c s3: Fix Coverity ID 2100, BAD_SIZEOF 2011-03-16 18:52:18 +01:00
winbindd_msrpc.c s3-libads: Use ldap_init_fd() to connect to AD server in socket_wrapper 2011-04-28 05:30:21 +02:00
winbindd_ndr.c s3: give ../librpc/ndr/util.c its own header. 2011-02-10 12:58:06 +01:00
winbindd_pam_auth_crap.c s3: Fix filling in the pam_auth_crap domain name 2010-11-26 14:43:20 +01:00
winbindd_pam_auth.c Fix bug #7589 - ntlm_auth fails to use cached credentials. 2010-07-29 12:44:00 -07:00
winbindd_pam_chauthtok.c s3: Move the in-memory ccache to the parent 2010-04-19 14:27:24 +02:00
winbindd_pam_chng_pswd_auth_crap.c s3: Convert WINBINDD_PAM_CHNG_PSWD_AUTH_CRAP to the new async API 2010-04-23 23:41:04 +02:00
winbindd_pam_logoff.c s3: Move the in-memory ccache to the parent 2010-04-19 14:27:24 +02:00
winbindd_pam.c s3:rpc_client: map fault codes to NTSTATUS with dcerpc_fault_to_nt_status() 2011-04-24 10:44:53 +02:00
winbindd_ping_dc.c s3:winbind: Fork multiple children per domain 2011-01-21 13:51:27 +01:00
winbindd_proto.h s3: Export WINBINDD_SIDS_TO_XIDS via the winbind pipe 2011-04-13 14:13:25 -07:00
winbindd_reconnect.c s3-winbindd: copy acct_info to wb_acct_info so we dont need passdb for it. 2011-03-30 01:13:08 +02:00
winbindd_rpc.c s3: Add wbint_LookupSids 2011-04-13 14:13:24 -07:00
winbindd_rpc.h s3-winbindd: copy acct_info to wb_acct_info so we dont need passdb for it. 2011-03-30 01:13:08 +02:00
winbindd_samr.c s3-rpc_client: add and use rpc_client/rpc_client.h. 2011-04-13 22:23:59 +02:00
winbindd_setgrent.c
winbindd_setpwent.c
winbindd_show_sequence.c
winbindd_sid_to_gid.c libcli/security Provide a common, top level libcli/security/security.h 2010-10-12 05:54:10 +00:00
winbindd_sid_to_uid.c libcli/security Provide a common, top level libcli/security/security.h 2010-10-12 05:54:10 +00:00
winbindd_sids_to_xids.c s3: Add some debug to winbindd_sids_to_xids 2011-04-13 14:13:25 -07:00
winbindd_uid_to_sid.c
winbindd_util.c s3: Add is_domain_online 2011-04-13 14:13:25 -07:00
winbindd_wins.c s3-libsmb: put namequery headers to nmblib.h 2011-03-30 01:13:09 +02:00
winbindd.c s3-winbind Use get_dyn_WINBINDD_SOCKET_DIR() to get the winbind pipe dir 2011-04-27 22:22:27 +10:00
winbindd.h s3-winbindd: copy acct_info to wb_acct_info so we dont need passdb for it. 2011-03-30 01:13:08 +02:00
wscript_build s3-waf: use SAMBA3_*() build rules in source3/build 2011-02-18 16:46:41 +11:00