Skip Menu |

This queue is for tickets about the C-Mlock CPAN distribution.

Report information
The Basics
Id: 128594
Status: resolved
Priority: 0/
Queue: C-Mlock

People
Owner: cpan [...] sorbs.net
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.11
Fixed in: (no value)



Subject: SEGV possible in test suite
Sometimes t/04-resize.t terminates with a SEGV: ... t/04-resize.t ..... All 7 subtests passed ... Test Summary Report ------------------- t/04-resize.t (Wstat: 11 Tests: 7 Failed: 0) Non-zero wait status: 11 ... I looked with valgrind into this test script: ... ok 3 - Set size to smaller ==5225== Invalid write of size 1 ==5225== at 0x7D88ADE: set_size (store.c:80) ==5225== by 0x7D889F8: set_pages (store.c:54) ==5225== by 0x7D877CE: XS_C__Mlock_set_pages (in /home/cpansand/.cpan/build/2019022309/C-Mlock-1.11-0/blib/arch/auto/C/Mlock/Mlock.so) ==5225== by 0x1CFDF7: Perl_pp_entersub (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x1C8702: Perl_runops_standard (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x152515: Perl_call_sv (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x154749: Perl_call_list (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x1380AE: S_process_special_blocks.isra.10 (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x14BA3E: Perl_newATTRSUB_x (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x180C6E: Perl_yyparse (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x158499: perl_parse (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x1363C5: main (in /opt/perl-5.24.3/bin/perl) ==5225== Address 0x7af6e20 is 16 bytes before a block of size 120 free'd ==5225== at 0x4C2CDDB: free (vg_replace_malloc.c:530) ==5225== by 0x1632F1: Perl_parser_free (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x1FE1D7: Perl_leave_scope (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x20C7E4: Perl_pp_leaveeval (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x1C8702: Perl_runops_standard (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x152515: Perl_call_sv (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x154749: Perl_call_list (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x1380AE: S_process_special_blocks.isra.10 (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x14BA3E: Perl_newATTRSUB_x (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x180C6E: Perl_yyparse (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x158499: perl_parse (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x1363C5: main (in /opt/perl-5.24.3/bin/perl) ==5225== Block was alloc'd at ==5225== at 0x4C2BBAF: malloc (vg_replace_malloc.c:299) ==5225== by 0x1AD074: Perl_safesysmalloc (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x16302F: Perl_lex_start (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x20BF72: Perl_pp_entereval (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x1C8702: Perl_runops_standard (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x152515: Perl_call_sv (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x154749: Perl_call_list (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x1380AE: S_process_special_blocks.isra.10 (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x14BA3E: Perl_newATTRSUB_x (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x180C6E: Perl_yyparse (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x158499: perl_parse (in /opt/perl-5.24.3/bin/perl) ==5225== by 0x1363C5: main (in /opt/perl-5.24.3/bin/perl) ==5225== ok 4 - Set size to larger ... Line 80 is: *(pAddressRegion->pBytes+bytes) = '\0'; /* terminate if we truncate */ but I don't see a condition to check if we're really truncating here?
Subject: Re: [rt.cpan.org #128594] SEGV possible in test suite
Date: Sat, 23 Feb 2019 23:06:41 +1100
To: bug-C-Mlock [...] rt.cpan.org
From: Michelle Sullivan <michelle [...] sorbs.net>
It’s putting in the safety.. it doesn’t need to condtest because if it’s an expand we calloc so it’s always zero terminated anyhow... going smaller if the data is truncated we need to make sure it’s zero terminated because otherwise Perl will read past the end of the allocation. ... think I might know the problem.. need to run some tests... problem is it only happens on certain platforms .... may just calloc and copy minus a byte rather than terminate what should be the last byte and see if that fixes it on the platforms that fail. Thanks for the report and diagnostics. Michelle Sullivan http://www.mhix.org/ Sent from my iPad Show quoted text
> On 23 Feb 2019, at 20:25, Slaven_Rezic via RT <bug-C-Mlock@rt.cpan.org> wrote: > > Sat Feb 23 04:25:33 2019: Request 128594 was acted upon. > Transaction: Ticket created by SREZIC > Queue: C-Mlock > Subject: SEGV possible in test suite > Broken in: 1.11 > Severity: (no value) > Owner: Nobody > Requestors: SREZIC@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=128594 > > > > Sometimes t/04-resize.t terminates with a SEGV: > > ... > t/04-resize.t ..... > All 7 subtests passed > ... > Test Summary Report > ------------------- > t/04-resize.t (Wstat: 11 Tests: 7 Failed: 0) > Non-zero wait status: 11 > ... > > I looked with valgrind into this test script: > > ... > ok 3 - Set size to smaller > ==5225== Invalid write of size 1 > ==5225== at 0x7D88ADE: set_size (store.c:80) > ==5225== by 0x7D889F8: set_pages (store.c:54) > ==5225== by 0x7D877CE: XS_C__Mlock_set_pages (in /home/cpansand/.cpan/build/2019022309/C-Mlock-1.11-0/blib/arch/auto/C/Mlock/Mlock.so) > ==5225== by 0x1CFDF7: Perl_pp_entersub (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x1C8702: Perl_runops_standard (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x152515: Perl_call_sv (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x154749: Perl_call_list (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x1380AE: S_process_special_blocks.isra.10 (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x14BA3E: Perl_newATTRSUB_x (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x180C6E: Perl_yyparse (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x158499: perl_parse (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x1363C5: main (in /opt/perl-5.24.3/bin/perl) > ==5225== Address 0x7af6e20 is 16 bytes before a block of size 120 free'd > ==5225== at 0x4C2CDDB: free (vg_replace_malloc.c:530) > ==5225== by 0x1632F1: Perl_parser_free (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x1FE1D7: Perl_leave_scope (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x20C7E4: Perl_pp_leaveeval (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x1C8702: Perl_runops_standard (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x152515: Perl_call_sv (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x154749: Perl_call_list (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x1380AE: S_process_special_blocks.isra.10 (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x14BA3E: Perl_newATTRSUB_x (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x180C6E: Perl_yyparse (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x158499: perl_parse (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x1363C5: main (in /opt/perl-5.24.3/bin/perl) > ==5225== Block was alloc'd at > ==5225== at 0x4C2BBAF: malloc (vg_replace_malloc.c:299) > ==5225== by 0x1AD074: Perl_safesysmalloc (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x16302F: Perl_lex_start (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x20BF72: Perl_pp_entereval (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x1C8702: Perl_runops_standard (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x152515: Perl_call_sv (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x154749: Perl_call_list (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x1380AE: S_process_special_blocks.isra.10 (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x14BA3E: Perl_newATTRSUB_x (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x180C6E: Perl_yyparse (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x158499: perl_parse (in /opt/perl-5.24.3/bin/perl) > ==5225== by 0x1363C5: main (in /opt/perl-5.24.3/bin/perl) > ==5225== > ok 4 - Set size to larger > ... > > Line 80 is: > > *(pAddressRegion->pBytes+bytes) = '\0'; /* terminate if we truncate */ > > but I don't see a condition to check if we're really truncating here? >
This should be resolved in 1.12 - please let me know if not. Reworked the logic (to what it should have been in the first place...) added a couple more tests to ensure the resizing works properly. Michelle