Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

segfault on readline without argument #8845

Closed
p5pRT opened this issue Mar 23, 2007 · 5 comments
Closed

segfault on readline without argument #8845

p5pRT opened this issue Mar 23, 2007 · 5 comments

Comments

@p5pRT
Copy link
Collaborator

@p5pRT p5pRT commented Mar 23, 2007

Migrated from rt.perl.org#42029 (status was 'resolved')

Searchable as RT42029$

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Mar 23, 2007

From zsbana@gmail.com

Created by ambrus@math.bme.hu

The oneliner 'warn readpipe;' causes a segmentation fault on my
interpreter. Here's the exact command and output, together with other
variants (note readpipe versus readline)​:

  $ perl -we 'warn readpipe;'
  Use of uninitialized value in quoted execution (``, qx) at -e line 1.
  Segmentation fault
  $ perl -we 'warn readline;'
  Use of uninitialized value in <HANDLE> at -e line 1.
  readline() on unopened filehandle at -e line 1.
  Segmentation fault
  $ perl -we 'warn readpipe();'
  Use of uninitialized value in quoted execution (``, qx) at -e line 1.
  Segmentation fault
  $ perl -we 'warn readline();'
  Use of uninitialized value in <HANDLE> at -e line 1.
  readline() on unopened filehandle at -e line 1.
  Segmentation fault

These outputs are from the perl version described by perlbug, that is,
v5.8.8 built for i686-linux. The system is i686-linux debian sarge
and this perl is a custom build.

I could also reproduce the segfault with the system perl on an linux-amd64
debian etch machine (v5.8.8 built for x86_64-linux-gnu-thread-multi).
Anno from perlmonks reports in the chatterbox that he could reproduce
the segfault with bleadperl.

Write me if you need any more info.

Thanks,
Ambrus

Perl Info

Flags:
    category=core
    severity=medium

Site configuration information for perl v5.8.8:

Configured by ambrus at Mon May 22 23:16:27 CEST 2006.

Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
    osname=linux, osvers=2.4.27-3-686, archname=i686-linux
    uname='linux king 2.4.27-3-686 #1 wed feb 8 12:40:33 utc 2006 i686
gnulinux '
    config_args=''
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -pipe -I/usr/local/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -pipe -I/usr/local/include'
    ccversion='', gccversion='3.3.5 (Debian 1:3.3.5-13)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.3.2.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.3.2'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:



@INC for perl v5.8.8:
    /usr/local/lib/perl5/5.8.8/i686-linux
    /usr/local/lib/perl5/5.8.8
    /usr/local/lib/perl5/site_perl/5.8.8/i686-linux
    /usr/local/lib/perl5/site_perl/5.8.8
    /usr/local/lib/perl5/site_perl
    .


Environment for perl v5.8.8:
    HOME=/home/ambrus
    LANG (unset)
    LANGUAGE=en_HU:en_US:en_GB:en
    LC_CTYPE=hu_HU
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/ambrus/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Mar 24, 2007

From @nwc10

On Fri, Mar 23, 2007 at 09​:14​:34AM -0700, Zsbán Ambrus wrote​:

The oneliner 'warn readpipe;' causes a segmentation fault on my
interpreter. Here's the exact command and output, together with other
variants (note readpipe versus readline)​:

Thanks for this report.

$ perl \-we 'warn readpipe;'
Use of uninitialized value in quoted execution \(\`\`\, qx\) at \-e line 1\.
Segmentation fault

I can reproduce this on the current maintenance branch, so it's not yet
solved. Under valgrind, I see​:

==9405== Invalid read of size 4
==9405== at 0x80EA75C​: Perl_pp_warn (pp_sys.c​:441)
==9405== by 0x807C895​: Perl_runops_debug (dump.c​:1650)
==9405== by 0x8096E05​: S_run_body (perl.c​:2475)
==9405== by 0x809685B​: perl_run (perl.c​:2390)
==9405== Address 0x1BAE6E7C is 4 bytes before a block of size 512 alloc'd
==9405== at 0x1B902E28​: malloc (vg_replace_malloc.c​:131)
==9405== by 0x807CF2B​: Perl_safesysmalloc (util.c​:91)
==9405== by 0x808F5AA​: Perl_av_extend (av.c​:158)
==9405== by 0x80D5FC2​: Perl_new_stackinfo (scope.c​:83)
==9405==
==9405== Invalid read of size 4
==9405== at 0x80EA764​: Perl_pp_warn (pp_sys.c​:443)
==9405== by 0x807C895​: Perl_runops_debug (dump.c​:1650)
==9405== by 0x8096E05​: S_run_body (perl.c​:2475)
==9405== by 0x809685B​: perl_run (perl.c​:2390)
==9405== Address 0x8 is not stack'd, malloc'd or (recently) free'd
==9405==
==9405== Process terminating with default action of signal 11 (SIGSEGV)
==9405== Access not within mapped region at address 0x8
==9405== at 0x80EA764​: Perl_pp_warn (pp_sys.c​:443)
==9405== by 0x807C895​: Perl_runops_debug (dump.c​:1650)
==9405== by 0x8096E05​: S_run_body (perl.c​:2475)
==9405== by 0x809685B​: perl_run (perl.c​:2390)

It looks like a problem with one of the interpreter's internal stacks, but
it's not clear to me where to look further.

On the development branch (which will become 5.10) it fails an assertion,
and running under valgrind reports a lot of warnings about invalid reads,
so it's clear that there's a bug there too. It doesn't appear to be the same
bug - it's in the code that formats the warning.

So two bugs for the price of one :-(

We may not be able to fix this in time for 5.8.9

Nicholas Clark

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Mar 24, 2007

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Mar 24, 2007

From @rgarcia

On 23/03/07, via RT Zsbán Ambrus <perlbug-followup@​perl.org> wrote​:

The oneliner 'warn readpipe;' causes a segmentation fault on my
interpreter.

Thanks for noticing. I don't see why readpipe() shouldn't default to
$_, so I made it so as change #30747.

@p5pRT
Copy link
Collaborator Author

@p5pRT p5pRT commented Mar 24, 2007

@rgs - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.