too many close calls for non-opened fds

Logu logsnaath at gmx.net
Mon Aug 14 15:05:26 EST 2006


Hello All,

I'm using OpenSSH 4.3p2 in HP-UX 11.23. On running tusc (a tool to trace 
system calls and signals) on sshd, I found lot of close calls upto 2047. 
Those close calls try to close a non-opened file descriptor and results in 
an error. This behaviour is seen only from OpenSSH 3.9 where closefrom() 
call is introduced to close the file descriptors before re-exec. The fix is 
to check the resource limits before calling close(), but the comment in 
source code (bsd-closefrom.c) says that it is not recommended to check the 
resource limits.  Is there anyway to fix this too many close() calls which 
results in performance degradation?

Relavant part of tusc output for sshd is given below,

...............
..............
set_userthreadid(1) ...................................... = 1
stat("/etc/pam_debug", 0x7ffff5b0) ....................... ERR#2 ENOENT
stat("/tcb/files/auth/system/default", 0x7fffec70) ....... ERR#2 ENOENT
getuid() ................................................. = 0 (0)
getuid() ................................................. = 0 (0)
getuid() ................................................. = 0 (0)
setgroups(0, NULL) ....................................... = 0
open("/dev/null", O_RDWR|0x800, 0123) .................... = 3
close(3) ................................................. = 0
sysconf(_SC_OPEN_MAX) .................................... = 2048
close(3) ................................................. ERR#9 EBADF
close(4) ................................................. ERR#9 EBADF
close(5) ................................................. ERR#9 EBADF
close(6) ................................................. ERR#9 EBADF
close(7) ................................................. ERR#9 EBADF
close(8) ................................................. ERR#9 EBADF
close(9) ................................................. ERR#9 EBADF
................
............... 




More information about the openssh-unix-dev mailing list