NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/46661: libpthread shouldn't provide __res_state()



>Number:         46661
>Category:       lib
>Synopsis:       libpthread shouldn't provide __res_state()
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jul 05 15:10:01 +0000 2012
>Originator:     River Tarnell <river%RT.UK.EU.ORG@localhost>
>Release:        NetBSD 6.0_BETA2
>Organization:
>Environment:
System: NetBSD infra.vm.internal.torchbox.com 6.0_BETA2 NetBSD 6.0_BETA2 
(XEN3_DOMU) amd64
Architecture: x86_64
Machine: amd64
>Description:

libpthread (src/lib/libpthread/res_state.c) provides its own version of 
__res_state() that aborts when called.  This breaks programs that use _res
and are linked to libpthread (examples include Postfix and Exim when using
libmysqlclient or libpq, and the DCC anti-spam system).

I've looked through the code and I don't see any reason why _res can't be
used from a program that links with -lpthread.  While it's not a thread-safe
interface, using it from a single thread would appear to work fine.

The libpthread __res_state should be removed to allow this to work again.

>How-To-Repeat:

yvaine# cat test.c
#include        <sys/types.h>
#include        <sys/socket.h>
#include        <netinet/in.h>
#include        <arpa/inet.h>
#include        <resolv.h>

int main() {
        void *p = &_res;
}
yvaine# cc test.c -o test -lpthread
yvaine# ./test
_res is not supported for multi-threaded programs.
zsh: abort (core dumped)  ./test

>Fix:
Remove __res_state from src/lib/libpthread/res_state.c.



Home | Main Index | Thread Index | Old Index