develooper Front page | perl.perl5.porters | Postings from January 2001

[ID 20010112.003] Excessively large set of values passed tosubroutine results in coredump

Thread Next
From:
rs
Date:
January 12, 2001 05:27
Subject:
[ID 20010112.003] Excessively large set of values passed tosubroutine results in coredump
Message ID:
200101121327.FAA17732@oregonnet.com

This is a bug report for perl from rs@cyndi.oregonnet.com,
generated with the help of perlbug 1.33 running under perl v5.7.0.


-----------------------------------------------------------------
[Please enter your report here]

#!./perl

sub break { print $#_ }
$a = 2;
break( (0) x (~0/$a) );

__END__

That code causes core dumps in 5.00503 and perl-current for me.  Some of the
more interesting values of $a are 1..6, 2**32, 2**35, 2**36, 2**38 - try
them carefully, if it doesn't core dump it'll eat RAM quickly.

This is all under 64-bit math, by the way.  For 5.00503 (32-bit), try 1..6
for $a to get more interesting results.

It appears I'm overflowing an Av in pp_hot.c (line 2744) called MARK;
I suppose it doesn't like being passed 2**63 arguments.  However,
the problem exists at 

My previous PL_modcount patch doesn't seem to affect it one way
or the other.

Tested perl-current with -D and -Uusemymalloc, no difference between them. 

Further testing requires sleep.

5.00503:

#0  0x807d7b8 in Perl_repeatcpy ()
#1  0x809188b in Perl_pp_repeat ()
#2  0x80b26dd in Perl_runops_standard ()
#3  0x80592c8 in perl_run ()
#4  0x80577df in main ()
#5  0x400a89cb in __libc_start_main (main=0x8057770 <main>, argc=2, argv=0xbffffcc4, init=0x8056ab8 <_init>, 
    fini=0x80b274c <_fini>, rtld_fini=0x4000ae60 <_dl_fini>, stack_end=0xbffffcbc)
    at ../sysdeps/generic/libc-start.c:92

perl-current (@8403):

#0  0x401b54a7 in memcpy (dstpp=0x805cc08, srcpp=0x805000c, len=4294967292)
at ../sysdeps/generic/memcpy.c:55
#1  0x4008d7ed in Perl_pp_entersub (my_perl=0x804b7f8) at pp_hot.c:2744
#2  0x4008651d in Perl_runops_debug (my_perl=0x804b7f8) at run.c:53
#3  0x40034efa in S_run_body (my_perl=0x804b7f8, oldscope=1) at perl.c:1457
#4  0x40034b40 in perl_run (my_perl=0x804b7f8) at perl.c:1379
#5  0x804949e in main (argc=2, argv=0xbffffcb4, env=0xbffffcc0) at perlmain.c:52

R.


[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=low
---
Site configuration information for perl v5.7.0:

Configured by rs at Thu Jan 11 18:09:23 PST 2001.

Summary of my perl5 (revision 5.0 version 7 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.2.14-5.0, archname=i686-linux-thread-multi-64all-ld
    uname='linux cyndi.oregonnet.com 2.2.14-5.0 #1 tue mar 7 21:07:39 est 2000 i686 unknown '
    config_args='-Dprefix=/home/rs/perl -Dusedevel -Dusethreads -Uuse5005threads -Duseithreads -Dusemultiplicity -Duseperlio -Duse64bitint -Duse64bitall -Duselongdouble -Doptimize=-O -g -Ubincompat5005 -Dusemorebits -Dusemymalloc -Duseshrplib -des'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=define use64bitall=define uselongdouble=define
  Compiler:
    cc='cc', ccflags ='-D_REENTRANT -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O -g',
    cppflags='-D_REENTRANT -DDEBUGGING -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long long', ivsize=8, nvtype='long double', nvsize=12, Off_t='off_t', lseeksize=8
    alignbytes=4, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lpthread -lc -lposix -lcrypt -lutil
    perllibs=-lnsl -ldl -lm -lpthread -lc -lposix -lcrypt -lutil
    libc=/lib/libc-2.1.3.so, so=so, useshrplib=true, libperl=libperl.so
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic -Wl,-rpath,/home/rs/perl/lib/5.7.0/i686-linux-thread-multi-64all-ld/CORE'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    DEVEL8403

---
@INC for perl v5.7.0:
    /home/rs/perl/lib/5.7.0/i686-linux-thread-multi-64all-ld
    /home/rs/perl/lib/5.7.0
    /home/rs/perl/lib/site_perl/5.7.0/i686-linux-thread-multi-64all-ld
    /home/rs/perl/lib/site_perl/5.7.0
    /home/rs/perl/lib/site_perl
    .

---
Environment for perl v5.7.0:
    HOME=/home/rs
    LANG=en_US
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/rs/perl/bin:/usr/bin:/bin:/usr/local/bin:/usr/X11R6/bin
    PERL_BADLANG (unset)
    SHELL=/bin/bash


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About