bugzilla-daemon at bugzilla.mindrot.org
2016-May-30  11:37 UTC
[Bug 2576] New: ssh-agent enters busy loop when running out of fds
https://bugzilla.mindrot.org/show_bug.cgi?id=2576
            Bug ID: 2576
           Summary: ssh-agent enters busy loop when running out of fds
           Product: Portable OpenSSH
           Version: 7.2p1
          Hardware: Other
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P5
         Component: ssh-agent
          Assignee: unassigned-bugs at mindrot.org
          Reporter: jjelen at redhat.com
>  Lennart Poettering 2016-05-04 18:28:09 CEST
ssh-agent starts eating 100% if it gets bombarded by connections, and
runs out of file descriptors to use. Looking at strace, it starts to
cycle in a select() loop, where the listening AF_UNIX socket is
reported active, which makes ssh-agent invoke accept() which will then
fail with EMFILE. It will then immediately invoke select() again, and
be in a busy loop from then on.
I figure ssh-agent should enforce a limit on concurrent connections
(that is much lower than RLIMIT_NOFILE) and quickly terminate further
incoming connections when that limit is hit. Most internet software
handles this that way, and I figure ssh-agent should do that too for
incoming local clients.
I noticed that while creating a ton of ssh connections to my local
system in a tight loop, which uses the ssh keyring.
(When ssh-agent is in this mode, and you start further ssh instances
with the & suffix in a shell (to make it background), then they will
also enter a busy loop handling of SIGTTOU. I don't have further
details about this, though, was too lazy to figure out what is really
going on there).
>  Jakub Jelen 2016-05-26 17:01:26 CEST 
I was trying to burn my virtual box with a lot of requests to ssh-agent
but only with partial success. But the behavior you explain sounds
possible.
My test case:
  eval `ulimit -n 10; ssh-agent`
  ssh-add rsa
  cat rsa.pub >> .ssh/authorized_keys
  for i in `seq 1 128`; do ssh localhost id & done
  ls /proc/$SSH_AGENT_PID/fd/ | wc -w
and I am left with few cycling ssh processes in some cases, or with the
ssh-agent live-locked.
-----------------------------------------------------------------------------
Copy from RHBZ#1333105 [1]. I can hack this somehow, but upstream fix
with proper evaluation would make more sense, if it is considered as an
issue.
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1333105
-- 
You are receiving this mail because:
You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2016-May-31  01:45 UTC
[Bug 2576] ssh-agent enters busy loop when running out of fds
https://bugzilla.mindrot.org/show_bug.cgi?id=2576
Damien Miller <djm at mindrot.org> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned-bugs at mindrot.org |djm at mindrot.org
                 CC|                            |djm at mindrot.org
--- Comment #1 from Damien Miller <djm at mindrot.org> ---
Created attachment 2818
  --> https://bugzilla.mindrot.org/attachment.cgi?id=2818&action=edit
avoid busy-wait on per-process fd exhaustion
This patch should fix the bad behaviour on per-process fd exhaustion,
but AFAIK ssh-agent will still spin if the system is globally
exhausted.
-- 
You are receiving this mail because:
You are watching someone on the CC list of the bug.
You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2016-May-31  01:45 UTC
[Bug 2576] ssh-agent enters busy loop when running out of fds
https://bugzilla.mindrot.org/show_bug.cgi?id=2576
Damien Miller <djm at mindrot.org> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |2543
Referenced Bugs:
https://bugzilla.mindrot.org/show_bug.cgi?id=2543
[Bug 2543] Tracking bug for OpenSSH 7.3 release
-- 
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2016-May-31  07:18 UTC
[Bug 2576] ssh-agent enters busy loop when running out of fds
https://bugzilla.mindrot.org/show_bug.cgi?id=2576 --- Comment #2 from Jakub Jelen <jjelen at redhat.com> --- Thank you for a prompt comment and patch. I build a package and tested successfully. I didn't see any more busy loop nor hang. -- You are receiving this mail because: You are watching someone on the CC list of the bug. You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2016-Jul-22  04:10 UTC
[Bug 2576] ssh-agent enters busy loop when running out of fds
https://bugzilla.mindrot.org/show_bug.cgi?id=2576 --- Comment #3 from Damien Miller <djm at mindrot.org> --- retarget unfinished bugs to next release -- You are receiving this mail because: You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2016-Jul-22  04:14 UTC
[Bug 2576] ssh-agent enters busy loop when running out of fds
https://bugzilla.mindrot.org/show_bug.cgi?id=2576
Damien Miller <djm at mindrot.org> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |2594
--- Comment #4 from Damien Miller <djm at mindrot.org> ---
retarget unfinished bugs to next release
Referenced Bugs:
https://bugzilla.mindrot.org/show_bug.cgi?id=2594
[Bug 2594] Tracking bug for OpenSSH 7.4 release
-- 
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2016-Jul-22  04:15 UTC
[Bug 2576] ssh-agent enters busy loop when running out of fds
https://bugzilla.mindrot.org/show_bug.cgi?id=2576 --- Comment #5 from Damien Miller <djm at mindrot.org> --- retarget unfinished bugs to next release -- You are receiving this mail because: You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2016-Jul-22  04:17 UTC
[Bug 2576] ssh-agent enters busy loop when running out of fds
https://bugzilla.mindrot.org/show_bug.cgi?id=2576 --- Comment #6 from Damien Miller <djm at mindrot.org> --- retarget unfinished bugs to next release -- You are receiving this mail because: You are watching someone on the CC list of the bug. You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2016-Jul-22  04:19 UTC
[Bug 2576] ssh-agent enters busy loop when running out of fds
https://bugzilla.mindrot.org/show_bug.cgi?id=2576
Damien Miller <djm at mindrot.org> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|2543                        |
Referenced Bugs:
https://bugzilla.mindrot.org/show_bug.cgi?id=2543
[Bug 2543] Tracking bug for OpenSSH 7.3 release
-- 
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2016-Dec-16  03:31 UTC
[Bug 2576] ssh-agent enters busy loop when running out of fds
https://bugzilla.mindrot.org/show_bug.cgi?id=2576
Damien Miller <djm at mindrot.org> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |2647
--- Comment #7 from Damien Miller <djm at mindrot.org> ---
OpenSSH 7.4 release is closing; punt the bugs to 7.5
Referenced Bugs:
https://bugzilla.mindrot.org/show_bug.cgi?id=2647
[Bug 2647] Tracking bug for OpenSSH 7.5 release
-- 
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2016-Dec-16  03:33 UTC
[Bug 2576] ssh-agent enters busy loop when running out of fds
https://bugzilla.mindrot.org/show_bug.cgi?id=2576
Damien Miller <djm at mindrot.org> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|2594                        |
Referenced Bugs:
https://bugzilla.mindrot.org/show_bug.cgi?id=2594
[Bug 2594] Tracking bug for OpenSSH 7.4 release
-- 
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2017-Jun-30  03:43 UTC
[Bug 2576] ssh-agent enters busy loop when running out of fds
https://bugzilla.mindrot.org/show_bug.cgi?id=2576
Damien Miller <djm at mindrot.org> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |2698
--- Comment #8 from Damien Miller <djm at mindrot.org> ---
Move incomplete bugs to openssh-7.6 target since 7.5 shipped a while
back.
To calibrate expectations, there's little chance all of these are going
to make 7.6.
Referenced Bugs:
https://bugzilla.mindrot.org/show_bug.cgi?id=2698
[Bug 2698] Tracking bug for OpenSSH 7.6 release
-- 
You are receiving this mail because:
You are watching someone on the CC list of the bug.
You are watching the assignee of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2017-Jun-30  03:44 UTC
[Bug 2576] ssh-agent enters busy loop when running out of fds
https://bugzilla.mindrot.org/show_bug.cgi?id=2576 --- Comment #9 from Damien Miller <djm at mindrot.org> --- remove 7.5 target -- You are receiving this mail because: You are watching the assignee of the bug. You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2017-Jun-30  03:45 UTC
[Bug 2576] ssh-agent enters busy loop when running out of fds
https://bugzilla.mindrot.org/show_bug.cgi?id=2576
Damien Miller <djm at mindrot.org> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|2647                        |
Referenced Bugs:
https://bugzilla.mindrot.org/show_bug.cgi?id=2647
[Bug 2647] Tracking bug for OpenSSH 7.5 release
-- 
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2017-Sep-22  03:29 UTC
[Bug 2576] ssh-agent enters busy loop when running out of fds
https://bugzilla.mindrot.org/show_bug.cgi?id=2576
Damien Miller <djm at mindrot.org> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |2782
Referenced Bugs:
https://bugzilla.mindrot.org/show_bug.cgi?id=2782
[Bug 2782] Tracking bug for OpenSSH 7.7 release
-- 
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2017-Sep-22  03:34 UTC
[Bug 2576] ssh-agent enters busy loop when running out of fds
https://bugzilla.mindrot.org/show_bug.cgi?id=2576
Damien Miller <djm at mindrot.org> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|2698                        |
Referenced Bugs:
https://bugzilla.mindrot.org/show_bug.cgi?id=2698
[Bug 2698] Tracking bug for OpenSSH 7.6 release
-- 
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2018-Apr-06  03:08 UTC
[Bug 2576] ssh-agent enters busy loop when running out of fds
https://bugzilla.mindrot.org/show_bug.cgi?id=2576
Damien Miller <djm at mindrot.org> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |2852
Referenced Bugs:
https://bugzilla.mindrot.org/show_bug.cgi?id=2852
[Bug 2852] Tracking bug for OpenSSH 7.8 release
-- 
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2018-Apr-06  03:12 UTC
[Bug 2576] ssh-agent enters busy loop when running out of fds
https://bugzilla.mindrot.org/show_bug.cgi?id=2576
Damien Miller <djm at mindrot.org> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|2782                        |
--- Comment #10 from Damien Miller <djm at mindrot.org> ---
Move to OpenSSH 7.8 tracking bug
Referenced Bugs:
https://bugzilla.mindrot.org/show_bug.cgi?id=2782
[Bug 2782] Tracking bug for OpenSSH 7.7 release
-- 
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2018-Apr-13  04:36 UTC
[Bug 2576] ssh-agent enters busy loop when running out of fds
https://bugzilla.mindrot.org/show_bug.cgi?id=2576
Damien Miller <djm at mindrot.org> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #2818|0                           |1
        is obsolete|                            |
                 CC|                            |dtucker at dtucker.net
   Attachment #3142|                            |ok?(dtucker at dtucker.net)
              Flags|                            |
--- Comment #11 from Damien Miller <djm at mindrot.org> ---
Created attachment 3142
  --> https://bugzilla.mindrot.org/attachment.cgi?id=3142&action=edit
updated to current
I rewrote ssh-agent's mainloop from select(2) to poll(2) a little while
ago. It makes this diff quite a bit simpler.
-- 
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2018-Apr-13  04:43 UTC
[Bug 2576] ssh-agent enters busy loop when running out of fds
https://bugzilla.mindrot.org/show_bug.cgi?id=2576
Darren Tucker <dtucker at dtucker.net> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #3142|ok?(dtucker at dtucker.net)    |ok+
              Flags|                            |
-- 
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2018-May-11  03:39 UTC
[Bug 2576] ssh-agent enters busy loop when running out of fds
https://bugzilla.mindrot.org/show_bug.cgi?id=2576
Damien Miller <djm at mindrot.org> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED
--- Comment #12 from Damien Miller <djm at mindrot.org> ---
Fix committed and will be in OpenSSH 7.8 - thanks
-- 
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
bugzilla-daemon at bugzilla.mindrot.org
2018-Oct-19  06:17 UTC
[Bug 2576] ssh-agent enters busy loop when running out of fds
https://bugzilla.mindrot.org/show_bug.cgi?id=2576
Damien Miller <djm at mindrot.org> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |CLOSED
--- Comment #13 from Damien Miller <djm at mindrot.org> ---
Close RESOLVED bugs with the release of openssh-8.0
-- 
You are receiving this mail because:
You are watching someone on the CC list of the bug.
You are watching the assignee of the bug.
Apparently Analagous Threads
- [Bug 2439] New: New sha256-base64 SSH Fingerprints in openssh-6.8
- [Bug 2501] New: VerifyHostKeyDNS & StrictHostKeyChecking
- [Bug 2400] New: StrictHostKeyChecking=no behaviour on HOST_CHANGED is excessively insecure
- [Bug 2440] New: X11 connection will fail if user's home directory is read-only
- [Bug 2158] New: Race condition in receiving SIGTERM