Skip Menu |

This queue is for tickets about the POE-XS-Loop-EPoll CPAN distribution.

Report information
The Basics
Id: 79013
Status: resolved
Priority: 0/
Queue: POE-XS-Loop-EPoll

People
Owner: Nobody in particular
Requestors: TEAM [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.001
Fixed in: (no value)



Subject: Segfault due to logic typo in _get_fd_entry
Hi there, Ran into a segfault on startup with metabase-relayd when using POE::XS::Loop::EPoll with https URLs, after some tracing it appears to be this piece of code: $ gdb `which perl` GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2) 7.4-2012.04 Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". For bug reporting instructions, please see: <http://bugs.launchpad.net/gdb-linaro/>... Reading symbols from /home/tom/perl5/perlbrew/perls/perl- 5.16.1/bin/perl...(no debugging symbols found)...done. (gdb) set args /home/tom/perl5/perlbrew/perls/perl-5.16.1/bin/metabase- relayd --idfile ~/.cpantesters/metabase_id.json --url https://metabase.cpantesters.org/api/v1/ --port 9323 --address 0.0.0.0 (gdb) run Starting program: /home/tom/perl5/perlbrew/perls/perl-5.16.1/bin/perl /home/tom/perl5/perlbrew/perls/perl-5.16.1/bin/metabase-relayd --idfile ~/.cpantesters/metabase_id.json --url https://metabase.cpantesters.org/api/v1/ --port 9323 --address 0.0.0.0 [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux- gnu/libthread_db.so.1". Running metabase-relayd with options: url https://metabase.cpantesters.org/api/v1/ dbfile /home/tom/.metabase/relay.db idfile /home/tom/.cpantesters/metabase_id.json address 0.0.0.0 port 9323 Program received signal SIGSEGV, Segmentation fault. 0x00007ffff518e909 in _get_fd_entry (fd=18797888) at EPoll.xs:194 194 return fd_lookup[fd]; (gdb) print fd $1 = 18797888 (gdb) print fd_lookup $2 = (int *) 0x1234ee0 (gdb) list 189 static int 190 _get_fd_entry(int fd) { 191 if (fd < 0 && fd >= fd_lookup_count) 192 return -1; 193 194 return fd_lookup[fd]; 195 } 196 197 static int 198 _make_fd_entry(int fd) { which the attached patch should resolve. Haven't had a chance to put together a proper test case for it, unfortunately, but with this applied so far I've had no recurrence of the original issue. best regards, Tom
Subject: poe-xs-loop-epoll_get_fd_entry_fix.patch
diff -uNPr POE-XS-Loop-EPoll-1.001-dE3Ae7/EPoll.xs POE-XS-Loop-EPoll-1.001-get_fd_entry_fix/EPoll.xs --- POE-XS-Loop-EPoll-1.001-dE3Ae7/EPoll.xs 2010-03-07 02:11:43.000000000 +0000 +++ POE-XS-Loop-EPoll-1.001-get_fd_entry_fix/EPoll.xs 2012-08-15 15:16:40.572777652 +0100 @@ -188,7 +188,7 @@ static int _get_fd_entry(int fd) { - if (fd < 0 && fd >= fd_lookup_count) + if (fd < 0 || fd >= fd_lookup_count) return -1; return fd_lookup[fd];
On Thu Aug 16 02:25:55 2012, TEAM wrote: Show quoted text
> Hi there, > > Ran into a segfault on startup with metabase-relayd when using > POE::XS::Loop::EPoll with https URLs, after some tracing it appears to > be this piece of code:
... Show quoted text
> 189 static int > 190 _get_fd_entry(int fd) { > 191 if (fd < 0 && fd >= fd_lookup_count) > 192 return -1; > 193 > 194 return fd_lookup[fd]; > 195 }
Oops, this was fixed in 1.002, released in August 2012. Tony