mirror of
https://github.com/nmap/nmap.git
synced 2025-12-16 04:39:03 +00:00
foudn that five files can be open on Mac OS X: stdin, stdout, stderr, /dev/tty, and /private/var/run/utmpx. This could cause a non-root scan at a high scan rateto fail with the message "Too many open files". I was able to cause this with "nmap --min-rate 5000 localhost -p-". That command still fails with the same error message, but for an entirely different reason. After a while, one of the connect calls fails with an errno of 22 = EINVAL, Invalid argument. Whatever this means, the socket doesn't get closed, Nmap just reports a "Strange error from connect". The socket is still open but Nmap doesn't include it in its count of open sockets, so it's off by one (or more, conceivably). This allows it to try to open one too many sockets and bomb with an error message. Note that running as non-root is important both because it uses a connect scan and because non-root users have a lower limit on open files. I've tried just closing the socket when EINVAL is returned, and that fixes the problem. But that's likely to differ on different systems. Plus I don't know why EINVAL is returned; maybe it's an OS bug. This only affects localhost scans and only at high scan rates, so I'm leaving it alone.
193 KiB
193 KiB