Bug 134567 - (IT_47533) nss_ldap improperly masks SIGPIPE when doing LDAP ops
nss_ldap improperly masks SIGPIPE when doing LDAP ops
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: nss_ldap (Show other bugs)
3.0
All Linux
medium Severity medium
: ---
: ---
Assigned To: Nalin Dahyabhai
Jay Turner
:
Depends On:
Blocks: 132991
  Show dependency treegraph
 
Reported: 2004-10-04 13:50 EDT by David Lehman
Modified: 2015-01-07 19:08 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-05-19 08:47:03 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
Patch: don't use sigprocmask to block SIGPIPE while doing LDAP stuff in nss_ldap (1.89 KB, patch)
2004-10-04 13:55 EDT, David Lehman
no flags Details | Diff


External Trackers
Tracker ID Priority Status Summary Last Updated
PADL Software 173 None None None Never

  None (edit)
Description David Lehman 2004-10-04 13:50:55 EDT
Description of problem:
nss_ldap uses sigprocmask to mask out SIGPIPE (instead of setting the
handler to SIG_IGN). So if a SIGPIPE is recieved while the mask was
set it's delivered as soon as the mask is reset, causing the
application making the nss call to exit.

Version-Release number of selected component (if applicable):
nss_ldap-207-11

How reproducible:
Not sure.

Steps to Reproduce:
1. set up a flakey LDAP server
2. run something like 'ls ~someuser' while the LDAP server is crashed
(stopping it might be adequate)
3. watch your shell die as a result of SIGPIPE not being blocked
  
Actual results:
The shell you're running the ls commands in will exit when nss_ldap
recieves a SIGPIPE.

Expected results:
Shell does not exit since nss_ldap knows to ignore SIGPIPE while
talking to server

Additional info:
Upsteam bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=130006
Comment 1 David Lehman 2004-10-04 13:52:22 EDT
Here's a gdb backtrace of a bash process suffering this bug. Notice
it's getting SIGPIPE'd while it's still in sigprocmask (immediately
after restoring the original signal mask).

Program received signal SIGPIPE, Broken pipe.
0xb74c4e99 in sigprocmask () from /lib/tls/libc.so.6
(gdb) bt
#0  0xb74c4e99 in sigprocmask () from /lib/tls/libc.so.6
#1  0xb72e2c2e in _nss_ldap_leave () at ldap-nss.c:508
#2  0xb72e4930 in _nss_ldap_getbyname (args=0xb75d1a98, result=0x0,
buffer=0x0, buflen=0, errnop=0x0, filterprot=0x0,
    sel=LM_PASSWD, parser=0) at ldap-nss.c:2658
#3  0xb72e57eb in _nss_ldap_getpwnam_r (name=0x0, result=0x0,
buffer=0x0, buflen=0, errnop=0x0) at ldap-pwd.c:190
#4  0xb7545552 in getpwnam_r@@GLIBC_2.1.2 () from /lib/tls/libc.so.6
#5  0xb7544fb1 in getpwnam () from /lib/tls/libc.so.6
#6  0x080b932d in tilde_expand_word (filename=0xb75d2bd8
"zó\020\bxó\020\bì\003") at tilde.c:350
#7  0x080b90b0 in tilde_expand (string=0x80fee4f "") at tilde.c:232
#8  0x080636b9 in bash_tilde_expand (s=0x80fee48 "~anscha",
assign_p=0) at general.c:733
#9  0x0807ef53 in shell_expand_word_list (tlist=0x80f4e88, eflags=31)
at subst.c:6567
#10 0x0807f01c in expand_word_list_internal (list=0x0, eflags=31) at
subst.c:6689
#11 0x0807ea99 in expand_words (list=0x0) at subst.c:6352
#12 0x08069706 in execute_simple_command (simple_command=0x80feb30,
pipe_in=-1, pipe_out=-1, async=0,
    fds_to_close=0x80e4ee0) at execute_cmd.c:2558
#13 0x08066d3a in execute_command_internal (command=0x8101e40,
asynchronous=0, pipe_in=-1, pipe_out=-1,
    fds_to_close=0x80e4ee0) at execute_cmd.c:633
#14 0x08066864 in execute_command (command=0x0) at execute_cmd.c:328
#15 0x0805c919 in reader_loop () at eval.c:143
#16 0x0805ae4b in main (argc=1, argv=0xbfffb4f4, env=0xbfffb4fc) at
shell.c:690
(gdb) c
Continuing.

Program terminated with signal SIGPIPE, Broken pipe.
The program no longer exists.
(gdb)
Comment 2 David Lehman 2004-10-04 13:55:02 EDT
Created attachment 104734 [details]
Patch: don't use sigprocmask to block SIGPIPE while doing LDAP stuff in nss_ldap
Comment 5 David Lehman 2004-11-18 12:39:53 EST
I believe this will fix Bug 124882 also.
Comment 10 Dennis Gregorovic 2005-05-19 08:47:03 EDT
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2005-247.html

Note You need to log in before you can comment on or make changes to this bug.