Subject: | The return code of select() in the getline() method of Net::Cmd is not properly checked |
Date: | Thu, 31 Aug 2006 16:56:37 +0100 |
To: | <bug-libnet [...] rt.cpan.org> |
From: | "Evans, Ben \(IT\)" <Ben.Evans [...] morganstanley.com> |
Hi Graham,
There's a seeming bug in recent libnets - including 1.19, whereby the
select() call
on line 269 of Net/Cmd.pm (at least in version 1.19) doesn't fully check
its' return code.
On platforms (including Linux and Mac) where the underlying select()
syscall
is not resumable after a signal happens, then the perl select() will
return
a negative number, which evaluates to true in the if statement, and then
allows control to fall into the branch with a sysread() - which looks
like
the wrong behaviour.
Elsewhere in the code, the return code of select() is fully checked -
shouldn't
it be here too?
Our reason for worrying about this is that we have observed a behaviour
we
are unable to reliably reproduce where if a second signal arrives, then
our
process can get stuck in a tight loop mmap2()ing memory.
Fixing the select() logic will insulate us from receiving the second
signal,
so should prevent the process loop.
Please let me know your thoughts, and if you need any more information
or sample
code, etc.
Thanks,
Ben
--
Ben Evans, ECT London, tel 677 4770
--------------------------------------------------------
NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.