1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
samba-mirror/source3
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
..
auth s3: Use wbcSidsToUnixIds in create_local_token 2011-04-13 14:13:25 -07:00
build dynconfig: Have only one dynconfig.o in the common code. 2011-04-27 22:22:26 +10:00
client s3: Use cli_writeall instead of cli_write 2011-04-26 12:22:55 -07:00
exports
groupdb s3-passdb: add passdb.h where needed. 2011-03-30 01:13:07 +02:00
include s3-libads: Use ldap_init_fd() to connect to AD server in socket_wrapper 2011-04-28 05:30:21 +02:00
intl s3-build: only include intl protos where needed. 2011-03-30 01:13:08 +02:00
lib lib/util/charset Merge talloc-based pull and push charset functions 2011-04-28 05:30:20 +02:00
libads s3-libads: Use ldap_init_fd() to connect to AD server in socket_wrapper 2011-04-28 05:30:21 +02:00
libgpo registry: create and use shared libcli/registry/util_reg.h header. 2011-03-30 01:13:07 +02:00
libnet s3:rpc_client: map fault codes to NTSTATUS with dcerpc_fault_to_nt_status() 2011-04-24 10:44:53 +02:00
librpc s3-rpc_server Fix compile without kerberos 2011-04-27 23:08:48 +02:00
libsmb s3-libads Pass a struct sockaddr_storage to cldap routines 2011-04-28 05:30:20 +02:00
locale s3: Fix a strange German translation 2011-04-28 10:13:50 +02:00
locking Trying to track down the SMB2 error. Add an invariant test. 2011-04-16 02:15:38 +02:00
m4 s3: Make nmbd socket dir configurable 2011-01-07 14:14:19 +01:00
modules s3:vfs use gpfs_lib_init 2011-04-26 20:52:36 +02:00
nmbd s3: only include smb profiling where needed. 2011-04-14 01:31:39 +02:00
pam_smbpass lib: make asn1_util a private library 2011-04-06 08:12:19 +02:00
param s3: Make vlp printing work by default 2011-04-05 13:12:14 +02:00
passdb s3: Fix Coverity ID 2471: UNINIT 2011-04-14 16:22:58 +02:00
pkgconfig s3-smbsharemodes: libsmbsharemodes does neither depend on krb5 or ldap. 2011-02-18 16:46:35 +01:00
po
printing Fix compiler warning in debug message. 2011-04-21 17:22:44 -07:00
profile s3-build: fix the --with-profiling-data build on mac os x. 2011-04-15 13:33:42 +02:00
registry s3: Fix Coverity ID 2047, UNUSED_VALUE 2011-04-22 10:53:24 +02:00
rpc_client s3:rpc_client: map fault codes to NTSTATUS with dcerpc_fault_to_nt_status() 2011-04-24 10:44:53 +02:00
rpc_server s3-rpc_server Fix compile without kerberos 2011-04-27 23:08:48 +02:00
rpcclient s3-rpcclient: include rpc_client/cli_pipe.h globally in rpcclient.h 2011-03-31 00:14:01 +02:00
script dynconfig: Have only one dynconfig.o in the common code. 2011-04-27 22:22:26 +10:00
selftest selftest: Fix combination of Samba3 and Samba4 test lists 2011-04-28 14:31:25 +10:00
services s3-auth: rpc_server needs auth.h 2011-03-30 01:13:09 +02:00
smbd s3: Fix a typo 2011-04-26 13:31:08 +02:00
stf
tests s3: Compile IDL files in autogen, some configure tests need this 2011-03-25 16:35:30 +01:00
torture s3: Use cli_writeall instead of cli_write 2011-04-26 12:22:55 -07:00
utils s3-libads Pass a struct sockaddr_storage to cldap routines 2011-04-28 05:30:20 +02:00
web dynconfig: Have only one dynconfig.o in the common code. 2011-04-27 22:22:26 +10:00
winbindd s3: Close the winbind client fds after forking 2011-04-28 12:06:12 +02:00
.clang_complete s3-build: remove -I../lib/addns. 2011-03-10 23:25:04 +01:00
.dmallocrc
.indent.pro
autogen-waf.sh s3-waf: add autogen-waf.sh to source3. 2010-09-24 11:26:11 -07:00
autogen.sh s3: Compile IDL files in autogen, some configure tests need this 2011-03-25 16:35:30 +01:00
change-log
config.guess
config.sub
configure.developer
configure.in auth/kerberos Add check for gss_inquire_sec_context_by_oid 2011-04-27 07:39:08 +02:00
Doxyfile
install-sh
mainpage.dox
Makefile-smbtorture4 build: Invert --enable-s3build into --disable-s3build 2011-04-26 04:27:28 +02:00
Makefile.in lib/util/charset Merge talloc-based pull and push charset functions 2011-04-28 05:30:20 +02:00
smbadduser.in
VERSION
wscript s3-libads: Use ldap_init_fd() to connect to AD server in socket_wrapper 2011-04-28 05:30:21 +02:00
wscript_build lib/util/charset use convert_string.c in common 2011-04-28 03:24:05 +02:00