Skip Menu |

This queue is for tickets about the Sys-LoadAvg CPAN distribution.

Report information
The Basics
Id: 120617
Status: new
Priority: 0/
Queue: Sys-LoadAvg

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

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



Subject: core dumps on Arm Linux
$ perl -MSys::LoadAvg -e 'Sys::LoadAvg::loadavg()' Segmentation fault $ This is true with any version of Perl. strace | tail gives lseek(4, 5720, SEEK_SET) = 5720 read(4, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1080) = 1080 lseek(4, 2917, SEEK_SET) = 2917 read(4, "A2\0\0\0aeabi\0\1(\0\0\0\0057-A\0\6\n\7A\10\1\t\2\n\4\22"..., 51) = 51 fstat64(4, {st_mode=S_IFREG|0555, st_size=6800, ...}) = 0 mmap2(NULL, 68428, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0xb6b49000 mprotect(0xb6b4a000, 61440, PROT_NONE) = 0 mmap2(0xb6b59000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0) = 0xb6b59000 close(4) = 0 close(3) = 0 open("/proc/loadavg", O_RDONLY) = 3 read(3, "1.19 1.21 1.41 3/217 17037\n", 64) = 27 close(3) = 0 --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x28f5c2ab} --- +++ killed by SIGSEGV +++ Segmentation fault 4.4.38-std-2 #1 SMP Tue Jan 10 14:50:25 UTC 2017 armv7l GNU/Linux gcc version 4.9.2
test.pl fails if I comment out the bottom lines: $ perl test.pl 1..1 # Running under perl version 5.014002 for linux # Current time local: Tue Mar 14 08:32:25 2017 # Current time GMT: Tue Mar 14 12:32:25 2017 # Using Test.pm version 1.25_02 ok 1 Segmentation fault
Also fails on another machine with 4.4.38-v7+ #938 SMP Thu Dec 15 15:22:21 GMT 2016 armv7l GNU/Linux
I've been discussing this with a friend who doesn't have a bitcard account. He tried it and gets the same error: # uname -a Linux bananapi 3.4.113-bananian #8 SMP PREEMPT Sat Nov 26 00:48:28 UTC 2016 armv7l GNU/Linux # perl -MSys::LoadAvg -e 'Sys::LoadAvg::loadavg()' Segmentation fault
The problem is that the array isn't big enough to fit the 3 doubles returned by getloadavg. To fix, in LoadAvg.xs replace this: double loadavg[2]; with this: double loadavg[3];