Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.99k stars 557 forks source link

Calling undef() on typeglobs crashes Win32 Perl 5.10.0 when fork() is called later on #9718

Closed p5pRT closed 14 years ago

p5pRT commented 15 years ago

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

Searchable as RT64954$

p5pRT commented 15 years ago

From @nilsonsfj

This is the smallest piece of code which reproduces the crash​:

  perl -e "undef *whatever; fork"

I can't confirm if this is specific to ActiveState Perl or Win32 Perl in general\, but this crashes perl every time it runs on AS Perl 5.10.0 build 1004. Below is the "perlbug -d" output​:


Flags​:   category=   severity=


Site configuration information for perl 5.10.0​:

Configured by SYSTEM at Wed Sep 3 13​:16​:08 2008.

Summary of my perl5 (revision 5 version 10 subversion 0) configuration​:   Platform​:   osname=MSWin32\, osvers=5.00\, archname=MSWin32-x86-multi-thread   uname=''   config_args='undef'   hint=recommended\, useposix=true\, d_sigaction=undef   useithreads=define\, usemultiplicity=define   useperlio=define\, d_sfio=undef\, uselargefiles=define\, usesocks=undef   use64bitint=undef\, use64bitall=undef\, uselongdouble=undef   usemymalloc=n\, bincompat5005=undef   Compiler​:   cc='cl'\, ccflags ='-nologo -GF -W3 -MD -Zi -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DUSE_SITECUSTOMIZE -DPRIVLIB_LAST_IN_INC -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX'\,   optimize='-MD -Zi -DNDEBUG -O1'\,   cppflags='-DWIN32'   ccversion='14.0.50727'\, gccversion=''\, gccosandvers=''   intsize=4\, longsize=4\, ptrsize=4\, doublesize=8\, byteorder=1234   d_longlong=undef\, longlongsize=8\, d_longdbl=define\, longdblsize=10   ivtype='long'\, ivsize=4\, nvtype='double'\, nvsize=8\, Off_t='__int64'\, lseeksize=8   alignbytes=8\, prototype=define   Linker and Libraries​:   ld='link'\, ldflags ='-nologo -nodefaultlib -debug -opt​:ref\,icf -libpath​:"C​:\Perl\lib\CORE" -machine​:x86'   libpth=\lib   libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib   perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib ws2_32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib   libc=msvcrt.lib\, so=dll\, useshrplib=true\, libperl=perl510.lib   gnulibc_version=''   Dynamic Linking​:   dlsrc=dl_win32.xs\, dlext=dll\, d_dlsymun=undef\, ccdlflags=' '   cccdlflags=' '\, lddlflags='-dll -nologo -nodefaultlib -debug -opt​:ref\,icf -libpath​:"C​:\Perl\lib\CORE" -machine​:x86'

Locally applied patches​:   ACTIVEPERL_LOCAL_PATCHES_ENTRY   33741 avoids segfaults invoking S_raise_signal() (on Linux)   33763 Win32 process ids can have more than 16 bits   32809 Load 'loadable object' with non-default file extension   32728 64-bit fix for Time​::Local


@​INC for perl 5.10.0​:   C​:/Perl/site/lib   C​:/Perl/lib   .


Environment for perl 5.10.0​:   HOME (unset)   LANG=PT   LANGUAGE (unset)   LD_LIBRARY_PATH (unset)   LOGDIR (unset)   PATH=C​:\Arquivos de programas\Microsoft Visual Studio 8\Common7\IDE;C​:\Arquivos de programas\Microsoft Visual Studio 8\VC\BIN;C​:\Arquivos de programas\Microsoft Visual Studio 8\Common7\Tools;C​:\Arquivos de programas\Microsoft Visual Studio 8\Common7\Tools\bin;C​:\Arquivos de programas\Microsoft Visual Studio 8\VC\PlatformSDK\bin;C​:\Arquivos de programas\Microsoft Visual Studio 8\SDK\v2.0\bin;C​:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C​:\Arquivos de programas\Microsoft Visual Studio 8\VC\VCPackages;C​:\Arquivos de programas\Microsoft Visual Studio 8\Common7\IDE;C​:\Arquivos de programas\Microsoft Visual Studio 8\VC\BIN;C​:\Arquivos de programas\Microsoft Visual Studio 8\Common7\Tools;C​:\Arquivos de programas\Microsoft Visual Studio 8\Common7\Tools\bin;C​:\Arquivos de programas\Microsoft Visual Studio 8\VC\PlatformSDK\bin;C​:\Arquivos de programas\Microsoft Visual Studio 8\SDK\v2.0\bin;C​:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C​:\Arquivos de programas\Microsoft Visual Studio 8\VC\VCPackages;C​:\Arquivos de programas\Microsoft Visual Studio 8\Common7\IDE;C​:\Arquivos de programas\Microsoft Visual Studio 8\VC\BIN;C​:\Arquivos de programas\Microsoft Visual Studio 8\Common7\Tools;C​:\Arquivos de programas\Microsoft Visual Studio 8\Common7\Tools\bin;C​:\Arquivos de programas\Microsoft Visual Studio 8\VC\PlatformSDK\bin;C​:\Arquivos de programas\Microsoft Visual Studio 8\SDK\v2.0\bin;C​:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C​:\Arquivos de programas\Microsoft Visual Studio 8\VC\VCPackages;C​:\Perl\site\bin;C​:\Perl\bin;C​:\Arquivos de programas\PC Connectivity Solution\;C​:\Arquivos de programas\MiKTeX 2.7\miktex\bin;C​:\Perl\bin;C​:\WINDOWS\system32;C​:\WINDOWS;C​:\WINDOWS\System32\Wbem;C​:\Arquivos de programas\TortoiseSVN\bin;C​:\Arquivos de programas\Git\cmd;C​:\Arquivos de programas\GnuWin32\bin;C​:\Arquivos de programas\QuickTime\QTSystem\   PERL_BADLANG (unset)   SHELL (unset)

-Nilson

p5pRT commented 15 years ago

From @nilsonsfj

I'm not sure if replying to this followup message will actually work\, but I just tested on Strawberry Perl and I got the same error. So the problem is Win32-specific\, not just AS-specific.

In other words​:

  perl -e "undef *whatever; fork"

Also crashes Strawberry Perl.

-Nilson

On Tue\, Apr 21\, 2009 at 8​:46 PM\, \perlbug\-followup@​perl\.org wrote​:

Greetings\,

This message has been automatically generated in response to the creation of a perl bug report regarding​:   "Calling undef() on typeglobs crashes Win32 Perl 5.10.0 when fork() is  called later on".

There is no need to reply to this message right now.  Your ticket has been assigned an ID of [perl #64954].  Within the next 24-72 hours\, your message will be posted to the perl developers.  Please be patient!

Please include the string​:

  [perl #64954]

in the subject line of all future correspondence about this issue. To do so\, you may reply to this message (please delete unnecessary quotes and text.)

 Thank you\,  perlbug-followup@​perl.org

------------------------------------------------------------------------- MIME-Version​: 1.0 X-Spam-Status​: No\, hits=-2.8 required=8.0 tests=DK_SIGNED\,PERLBUG_CONF\,SPF_NEUTRAL X-Old-Spam-Check-BY​: la.mx.develooper.com content-type​: text/plain; charset="utf-8" Message-ID​: \9a08c9b40904211645jc95d386oabff12c38c500e6f@​mail\.gmail\.com Received​: (qmail 30664 invoked from network); 21 Apr 2009 23​:46​:19 -0000 Received​: from localhost (HELO la.mx.develooper.com) (127.0.0.1) by localhost with SMTP; 21 Apr 2009 23​:46​:19 -0000 Received​: (qmail 30660 invoked by alias); 21 Apr 2009 23​:46​:19 -0000 Received​: from la.mx.develooper.com (HELO x1.develooper.com) (207.171.7.76) by la.mx.develooper.com (qpsmtpd/0.28) with SMTP; Tue\, 21 Apr 2009 16​:46​:12 -0700 Received​: (qmail 30649 invoked by uid 225); 21 Apr 2009 23​:46​:09 -0000 Received​: (qmail 30645 invoked by alias); 21 Apr 2009 23​:46​:09 -0000 Received​: from mail-gx0-f180.google.com (HELO mail-gx0-f180.google.com) (209.85.217.180) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Tue\, 21 Apr 2009 16​:46​:03 -0700 Received​: by gxk28 with SMTP id 28so6555488gxk.2 for \perlbug@​perl\.org; Tue\, 21 Apr 2009 16​:45​:59 -0700 (PDT) Received​: by 10.151.147.10 with SMTP id z10mr9394364ybn.159.1240357558852;  Tue\, 21 Apr 2009 16​:45​:58 -0700 (PDT) Delivered-To​: rt-perl5@​netlabs.develooper.com Delivered-To​: perlbug@​perl.org Subject​: Calling undef() on typeglobs crashes Win32 Perl 5.10.0 when fork() is  called later on Return-Path​: \acid06@​gmail\.com Domainkey-Signature​: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version​:sender​:date​:x-google-sender-auth​:message-id​:subject :from​:to​:content-type​:content-transfer-encoding; b=TK7s/pL8MQhvGkLzAV3bjOzj2paSqSvReEezQcVtUqQDVyL5Vr84Ao0ykYEfwx/3UX MDJFkokYvwvbfmgf+4qrhitq0iIzsq2dCoWgpur/FOebl/XXMpfgdlsLhWDwMVCbdsrQ soMEafixFlltYHOw4XNFX/lDwmervFqzjGG+I= X-Spam-Check-BY​: la.mx.develooper.com Dkim-Signature​: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature​:mime-version​:sender​:received​:date :x-google-sender-auth​:message-id​:subject​:from​:to​:content-type :content-transfer-encoding; bh=/6g0sISyrTQ9j4e1eBJZ1ff20pIH7dLFPi6H2wujgZU=; b=ct3nuZxxdIqnWfHxbAPaak4vexewite5+wvmyqFaxTtJwspRzwsMJqWiEtkukGeBGY ssWiWucgWRdgnFw5eMTu7vUzVuKWpeE6mLb8X+o8zOp18Z3UBedi9NAu46bo/eY5y7we a7EUYLlmGEJufz+7B/TK1tFA0bVtc/VILppOg= X-Old-Spam-Status​: No\, hits=-4.0 required=8.0 tests=DK_SIGNED\,PERLBUG_CONF\,SPF_PASS X-Google-Sender-Auth​: 480f6d9ee5aa7594 Sender​: acid06@​gmail.com Date​: Tue\, 21 Apr 2009 20​:45​:58 -0300 To​: perlbug@​perl.org Content-Transfer-Encoding​: 7bit From​: Nilson Santos Figueiredo Junior \nilsonsfj@​cpan\.org X-RT-Original-Encoding​: ISO-8859-1

p5pRT commented 15 years ago

From @iabyn

On Tue\, Apr 21\, 2009 at 09​:34​:54PM -0300\, Nilson Santos Figueiredo Junior wrote​:

I'm not sure if replying to this followup message will actually work\, but I just tested on Strawberry Perl and I got the same error. So the problem is Win32-specific\, not just AS-specific.

In other words​:

perl -e "undef *whatever; fork"

Also crashes Strawberry Perl.

This is a threads cloning issue. This crashes on Linux​:

  use threads;   undef *whatever;   threads->new(sub {})->join;

Its crashing in Perl_hek_dup()\, because it assumes that the 'source' arg is not null\, while in the caller\, in Perl_gp_dup()​:

  ret->gp_file_hek = hek_dup(gp->gp_file_hek\, param);

here\, gp->gp_file_hek is null. I don't know whether the fault is that gp->gp_file_hek shouldn't be null\, or that Perl_gp_dup and/or Perl_hek_dup should be able to cope with a null value.

Still present in blead.

-- Red sky at night - gerroff my land! Red sky at morning - gerroff my land!   -- old farmers' sayings #14

p5pRT commented 15 years ago

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

p5pRT commented 15 years ago

From @nilsonsfj

On Wed\, Apr 22\, 2009 at 12​:45 PM\, Dave Mitchell via RT \perlbug\-followup@​perl\.org wrote​:

Its crashing in Perl_hek_dup()\, because it assumes that the 'source' arg is not null\, while in the caller\, in Perl_gp_dup()​:

ret->gp_file_hek = hek_dup(gp->gp_file_hek\, param);

here\, gp->gp_file_hek is null. I don't know whether the fault is that gp->gp_file_hek shouldn't be null\, or that Perl_gp_dup and/or Perl_hek_dup should be able to cope with a null value.

Still present in blead.

Will this be fixed for the next release?

It's a serious issue for all platforms as it can make Perl useless for those who use threads (so maybe change the OS in RT to "All" or something like that).

But it's specially bad for Windows Perl since it makes it useless for *a lot more* things\, as fork() is emulated using threads. You can't even install some modules as the CPAN shell (which forks) will crash perl. The Catalyst builtin server also crashes when running in auto-restart mode\, as that's handled using a fork. You get the idea.

-Nilson

p5pRT commented 15 years ago

From @nwc10

On Thu\, Apr 30\, 2009 at 04​:18​:43PM -0300\, Nilson Santos Figueiredo Junior wrote​:

On Wed\, Apr 22\, 2009 at 12​:45 PM\, Dave Mitchell via RT \perlbug\-followup@​perl\.org wrote​:

Its crashing in Perl_hek_dup()\, because it assumes that the 'source' arg is not null\, while in the caller\, in Perl_gp_dup()​:

ret->gp_file_hek = hek_dup(gp->gp_file_hek\, param);

here\, gp->gp_file_hek is null. I don't know whether the fault is that gp->gp_file_hek shouldn't be null\, or that Perl_gp_dup and/or Perl_hek_dup should be able to cope with a null value.

Still present in blead.

Will this be fixed for the next release?

Almost certainly yes.

Nicholas Clark

p5pRT commented 15 years ago

From @nwc10

On Wed\, Apr 22\, 2009 at 04​:44​:45PM +0100\, Dave Mitchell wrote​:

Its crashing in Perl_hek_dup()\, because it assumes that the 'source' arg is not null\, while in the caller\, in Perl_gp_dup()​:

ret\->gp\_file\_hek    = hek\_dup\(gp\->gp\_file\_hek\, param\);

here\, gp->gp_file_hek is null. I don't know whether the fault is that gp->gp_file_hek shouldn't be null\, or that Perl_gp_dup and/or Perl_hek_dup should be able to cope with a null value.

Two distinct parts of the code imply that it's rare\, but legal\, for gp->gp_file_hek to be NULL.

Still present in blead.

Fixed in blead with 1dffc4d1a24556f4e23f612d6713492847ff064b

Nicholas Clark

p5pRT commented 14 years ago

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