Skip Menu |

This queue is for tickets about the File-Map CPAN distribution.

Report information
The Basics
Id: 105833
Status: resolved
Priority: 0/
Queue: File-Map

People
Owner: Nobody in particular
Requestors: tom [...] eborcom.com
Cc:
AdminCc:

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



Subject: File::Map Segmentation Fault
Hi, Leon. The attached script (file_map_segfault.pl) reliably causes a segmentation fault. Admittedly, the script takes an approach that File::Map documents as risky, but I wonder if the segfault indicates an unrecognised problem somewhere. I have run this script on few versions of Perl from 5.18 onwards, including blead, on FreeBSD 9 and 10. I always see the same segfault. Running the script under valgrind produces the following output: ==34731== Memcheck, a memory error detector ==34731== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al. ==34731== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info ==34731== Command: /home/tom/perl-inst/perl-5.23_debugging_20150713/bin/perl segfault ==34731== ==34731== Invalid write of size 1 ==34731== at 0x5096A8: Perl_sv_setpvn (sv.c:4856) ==34731== by 0x68157EA: XS_File__Map__mmap_impl (Map.xs:553) ==34731== by 0x4FDE2D: Perl_pp_entersub (pp_hot.c:3274) ==34731== by 0x4CA229: Perl_runops_debug (dump.c:2224) ==34731== by 0x44AFC8: S_run_body (perl.c:2448) ==34731== by 0x44AFC8: perl_run (perl.c:2371) ==34731== by 0x420075: main (perlmain.c:116) ==34731== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==34731== ==34731== ==34731== Process terminating with default action of signal 11 (SIGSEGV): dumping core ==34731== Access not within mapped region at address 0x0 ==34731== at 0x5096A8: Perl_sv_setpvn (sv.c:4856) ==34731== by 0x68157EA: XS_File__Map__mmap_impl (Map.xs:553) ==34731== by 0x4FDE2D: Perl_pp_entersub (pp_hot.c:3274) ==34731== by 0x4CA229: Perl_runops_debug (dump.c:2224) ==34731== by 0x44AFC8: S_run_body (perl.c:2448) ==34731== by 0x44AFC8: perl_run (perl.c:2371) ==34731== by 0x420075: main (perlmain.c:116) ==34731== If you believe this happened as a result of a stack ==34731== overflow in your program's main thread (unlikely but ==34731== possible), you can try to increase the size of the ==34731== main thread stack using the --main-stacksize= flag. ==34731== The main thread stack size used in this run was 16777216. ==34731== ==34731== HEAP SUMMARY: ==34731== in use at exit: 1,263,969 bytes in 4,140 blocks ==34731== total heap usage: 11,287 allocs, 7,147 frees, 2,576,549 bytes allocated ==34731== ==34731== LEAK SUMMARY: ==34731== definitely lost: 0 bytes in 0 blocks ==34731== indirectly lost: 0 bytes in 0 blocks ==34731== possibly lost: 649,220 bytes in 828 blocks ==34731== still reachable: 614,749 bytes in 3,312 blocks ==34731== suppressed: 0 bytes in 0 blocks ==34731== Rerun with --leak-check=full to see details of leaked memory ==34731== ==34731== For counts of detected and suppressed errors, rerun with: -v ==34731== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 11 from 4) Please let me know if I can provide any more information to help investigate this. Tom
Subject: file_map_segfault.pl
#!perl use strict; use warnings; use File::Map 'map_file'; foreach my $filename ( 1, 2 ) { my $output_filename = 'example_' . $filename; map_file my $output, $output_filename, '+>'; }
Subject: Re: [rt.cpan.org #105833] File::Map Segmentation Fault
Date: Mon, 13 Jul 2015 12:53:34 +0200
To: bug-File-Map [...] rt.cpan.org
From: Leon Timmermans <leont [...] cpan.org>
On Mon, Jul 13, 2015 at 11:46 AM, Tom Hukins via RT < bug-File-Map@rt.cpan.org> wrote: Show quoted text
> Hi, Leon. > > The attached script (file_map_segfault.pl) reliably causes a segmentation > fault. Admittedly, the script takes an approach that File::Map documents > as risky, but I wonder if the segfault indicates an unrecognised problem > somewhere. > > I have run this script on few versions of Perl from 5.18 onwards, > including blead, on FreeBSD 9 and 10. I always see the same segfault. > > Running the script under valgrind produces the following output: >
That is indeed a bug. I just released a fix in File::Map 0.64. Thanks for your report. Leon