Bug 10556 - memdup symbol clash in libsamba-util and libnetsnmp
memdup symbol clash in libsamba-util and libnetsnmp
Status: RESOLVED FIXED
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Other
unspecified
All All
: P5 normal
: ---
Assigned To: Karolin Seeger
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-04-16 20:51 UTC by Björn Baumbach
Modified: 2014-10-13 10:52 UTC (History)
2 users (show)

See Also:


Attachments
proposed patch for 4.0, cherry-picked from master (6.94 KB, patch)
2014-04-16 21:00 UTC, Björn Baumbach
vl: review+
jra: review+
Details
proposed patch for 4.1, cherry-picked from master (6.39 KB, patch)
2014-04-16 21:01 UTC, Björn Baumbach
vl: review+
jra: review+
Details
new proposed patch for 4.1, cherry-picked from master (6.94 KB, patch)
2014-05-06 09:55 UTC, Björn Baumbach
jra: review+
vl: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Björn Baumbach 2014-04-16 20:51:08 UTC
The libnetsnmp provides an own memdup() function and
typically this one does not use symbol versioning, like our memdup() in libsamba-util.
In this case I encountered the libsmbconf prefers the unversioned memdup() instead of our own memdup().

I give an example:
A system uses the nss_wins module. A tool tries to get a host by name,
using the netsnmp_getaddrinfo() from the libnetsnmp. This ends in a
_nss_wins_gethostbyname_r() call by the nss_wins, which calls the
memdup() function of the libnetsnmp (instead of the memdup() of
libsamba-util()).

I think this backtrace explains this a bit better:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7886886 in __memcpy_ssse3_back () from /lib64/libc.so.6
(gdb) bt
#0  0x00007ffff7886886 in __memcpy_ssse3_back () from /lib64/libc.so.6
#1  0x00007ffff7b54724 in memdup () from /usr/lib64/libnetsnmp.so.30
#2  0x00007ffff5c56572 in load_interfaces () from /usr/lib64/libsmbconf.so.0
#3  0x00007ffff64f74ee in _nss_wins_gethostbyname_r () from
/usr/lib64/libnss_wins.so.2
#4  0x00007ffff7853601 in gethostbyname2_r () from /lib64/libc.so.6
#5  0x00007ffff7825e2f in gaih_inet () from /lib64/libc.so.6
#6  0x00007ffff7827de4 in getaddrinfo () from /lib64/libc.so.6
#7  0x00007ffff7b4b2bc in netsnmp_getaddrinfo () from
/usr/lib64/libnetsnmp.so.30
#8  0x00007ffff7b4b4c6 in netsnmp_gethostbyname_v4 () from
/usr/lib64/libnetsnmp.so.30
#9  0x00007ffff7b6933c in netsnmp_sockaddr_in2 () from
/usr/lib64/libnetsnmp.so.30
#10 0x00007ffff7b6c042 in netsnmp_udp_create_tstring () from
/usr/lib64/libnetsnmp.so.30
#11 0x00007ffff7b65289 in netsnmp_tdomain_transport_full () from
/usr/lib64/libnetsnmp.so.30
#12 0x00007ffff7b38fd3 in snmp_sess_open () from /usr/lib64/libnetsnmp.so.30
#13 0x00007ffff7b39229 in snmp_open () from /usr/lib64/libnetsnmp.so.30
#14 0x0000000000401714 in main ()
Comment 1 Björn Baumbach 2014-04-16 21:00:31 UTC
Created attachment 9855 [details]
proposed patch for 4.0, cherry-picked from master
Comment 2 Björn Baumbach 2014-04-16 21:01:08 UTC
Created attachment 9856 [details]
proposed patch for 4.1, cherry-picked from master
Comment 3 Jeremy Allison 2014-04-16 21:34:58 UTC
Re-assigning to Karolin for inclusion in 4.1.next, 4.0.next.
Jeremy.
Comment 4 Karolin Seeger 2014-04-29 08:33:34 UTC
Pushed to autobuild-v4-[0|1]-test.
Comment 5 Karolin Seeger 2014-05-06 09:37:42 UTC
(In reply to comment #4)
> Pushed to autobuild-v4-[0|1]-test.

Pushed to v4-0-test, but building in v4-1-test fails with:

../source3/locking/brlock.c: In function 'brl_traverse_fn':
../source3/locking/brlock.c:1777: error: implicit declaration of
function 'memdup'
../source3/locking/brlock.c:1777: warning: cast to pointer from integer
of different size
../source3/rpc_server/rpc_sock_helper.c: In function
'rpc_create_tcpip_sockets':
../source3/rpc_server/rpc_sock_helper.c:75: warning: cast discards
qualifiers from pointer target type
../source3/rpc_server/rpc_sock_helper.c: In function
'rpc_setup_tcpip_sockets':
../source3/rpc_server/rpc_sock_helper.c:199: warning: cast discards
qualifiers from pointer target type
Waf: Leaving directory `/memdisk/kseeger/a41/b761433/samba/bin'
Build failed:  -> task failed (err #1):
        {task: cc brlock.c -> brlock_94.o}
make: *** [all] Error 1

Re-assigning to Björn Baumbach.
Comment 6 Björn Baumbach 2014-05-06 09:55:20 UTC
Created attachment 9907 [details]
new proposed patch for 4.1, cherry-picked from master

Sorry.
Please find the new one attached.

Björn
Comment 7 Jeremy Allison 2014-05-07 17:49:07 UTC
Comment on attachment 9907 [details]
new proposed patch for 4.1, cherry-picked from master

Compiles happily for me on 4.1.x :-).
Comment 8 Jeremy Allison 2014-05-07 17:49:30 UTC
Re-assigning to Karolin for 4.1.next, 4.0.next.

Jeremy.
Comment 9 Karolin Seeger 2014-05-20 09:50:53 UTC
(In reply to comment #8)
> Re-assigning to Karolin for 4.1.next, 4.0.next.
> 
> Jeremy.

Pushed to autobuild-v4-1-test (already included in v4-0-test).
Comment 10 Karolin Seeger 2014-05-27 19:15:00 UTC
(In reply to comment #9)
> (In reply to comment #8)
> > Re-assigning to Karolin for 4.1.next, 4.0.next.
> > 
> > Jeremy.
> 
> Pushed to autobuild-v4-1-test (already included in v4-0-test).

Pushed to v4-1-test.
Closing out bug report.

Thanks!