Bug 14489 - ./configure.developer --nonshared-binary=smbtorture,smbd/smbd fails to start
Summary: ./configure.developer --nonshared-binary=smbtorture,smbd/smbd fails to start
Status: ASSIGNED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Build (show other bugs)
Version: 4.13.0rc3
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Jeremy Allison
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-11 02:07 UTC by Andrew Bartlett
Modified: 2020-09-14 21:27 UTC (History)
0 users

See Also:


Attachments
test log from 'make test TESTS="samba3.smb2.create.*nt4_dc"' (4.18 KB, text/x-log)
2020-09-11 02:07 UTC, Andrew Bartlett
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Bartlett 2020-09-11 02:07:27 UTC
Created attachment 16220 [details]
test log from 'make test TESTS="samba3.smb2.create.*nt4_dc"'

smbd fails to start in this configuration, which we claim to test in autobuild because we fail to check that the server will start.

./configure.developer --nonshared-binary=smbtorture,smbd/smbd
make -j
make test TESTS="samba3.smb2.create.*nt4_dc"
Comment 1 Andrew Bartlett 2020-09-11 02:22:53 UTC
Once this is fixed we are reduce the length of the CI further as we can then combine the staticish/nonshared smbd build with the --disable-python build and test.
Comment 2 Andrew Bartlett 2020-09-11 03:04:32 UTC
To be clear I don't have a fix pending for this one, I would really appreciate anyone who cares about the semi-static smbd picking this up and working out what is going on here.
Comment 3 Jeremy Allison 2020-09-11 21:54:15 UTC
Looking at this at debug level 10, it is a socket-wrapper library issue:

bind failed on port 445 socket_addr = fd00::5357:5f03.
Error = Permission denied
smbd_open_one_socket: open_socket_in: Permission denied
bind failed on port 139 socket_addr = fd00::5357:5f03.
Error = Permission denied
smbd_open_one_socket: open_socket_in: Permission denied
bind failed on port 445 socket_addr = 10.53.57.3.
Error = Cannot assign requested address
smbd_open_one_socket: open_socket_in: Cannot assign requested address
bind failed on port 139 socket_addr = 10.53.57.3.
Error = Cannot assign requested address
smbd_open_one_socket: open_socket_in: Cannot assign requested address
open_sockets_smbd: No sockets available to bind to.

That's a signal that socket_wrapper isn't being invoked.

If you set: export SOCKET_WRAPPER_DEBUGLEVEL=3
and look inside st/logs/log.smbd on a non-static build you see:

SWRAP_TRACE[smbd (PID)] - swrap_bind: bind() path=/home/jeremy/src/samba/git/merge/st/w/X030087, fd=32

messages.

In the semi-static build you see:

SWRAP_TRACE[gdb (1080955)] - swrap_remove_stale: remove stale wrapper for 42
        __result = <optimized out>
        _buffer = {__routine = 0x7f6c44f2e290 <cancel_handler>, __arg = 0x7ffc162c5140, __canceltype = 0, __prev = 0x0}
        _avail = 1
        cancel_args = {quit = 0x7f6c450c7200 <quit>, intr = 0x7f6c450c72a0 <intr>, pid = 1080944}
        status = -1
        ret = 0
        pid = 1080944
        sa = {__sigaction_handler = {sa_handler = 0x1, sa_sigaction = 0x1}, sa_mask = {__val = {65536, 0 <repeats 15 times>}}, sa_flags = 0, sa_restorer = 0x164
        omask = {__val = {6272, 152, 94371006167712, 4294967448, 140720680489696, 140103002942345, 154, 152, 140102991629280, 140102991629280, 140102991629280,
        reset = {__val = {6, 0 <repeats 15 times>}}
        spawn_attr = {__flags = 12, __pgrp = 0, __sd = {__val = {6, 0 <repeats 15 times>}}, __ss = {__val = {6272, 152, 94371006167712, 4294967448, 140720680489
        __cnt = <optimized out>
        __set = <optimized out>
        __cnt = <optimized out>
        __set = <optimized out>
#3  0x000055d475ba2cdd in smb_panic_s3 (why=0x55d475ea7889 "open_sockets_smbd() failed") at ../../source3/lib/util.c:840
Comment 4 Jeremy Allison 2020-09-11 21:54:55 UTC
To be more accurate, socket_wrapper is being invoked - just not working properly :-).
Comment 5 Jeremy Allison 2020-09-11 22:08:07 UTC
In a working (non-static) build:

$ ldd bin/smbd|grep socket
	libsocket-blocking-samba4.so => /home/jeremy/src/samba/git/merge/bin/shared/private/libsocket-blocking-samba4.so (0x00007ff567b1d000)
	libsamba-sockets-samba4.so => /home/jeremy/src/samba/git/merge/bin/shared/private/libsamba-sockets-samba4.so (0x00007ff566a29000)


In a non-working (semi-static) build:

$ ldd bin/smbd|grep socket
$
Comment 6 Andrew Bartlett 2020-09-14 21:18:22 UTC
(In reply to Jeremy Allison from comment #5)
Very interesting.  The ldd isn't detecting socket_wrapper (it isn't linked in, it is subject to LD_PRELOAD, and those libs are other socket things, not socket_wrapper) but clearly from the debug logs this is related.

So it could be that "semi-static builds can't work with socket_wrapper" but I can't think of a reason why that would have to be the case and that would be unfortunate, as then we can't test semi-static builds work.  

Hmm.
Comment 7 Jeremy Allison 2020-09-14 21:27:48 UTC
Yes, I realized later that the

$ ldd bin/smbd|grep socket

was a red herring. What seems to be happening is the lookup functions inside socket_wrapper aren't finding the glibc functions to replace in the semi-static build for some reason. I was planning to look into this further later this week.