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

fatal undef warning in eval in sort crashes perl #16882

Open
p5pRT opened this issue Mar 9, 2019 · 5 comments
Open

fatal undef warning in eval in sort crashes perl #16882

p5pRT opened this issue Mar 9, 2019 · 5 comments

Comments

@p5pRT
Copy link

p5pRT commented Mar 9, 2019

Migrated from rt.perl.org#133916 (status was 'open')

Searchable as RT133916$

@p5pRT
Copy link
Author

p5pRT commented Mar 9, 2019

From @wchristian

This is a bug report for perl from walde.christian@​gmail.com,
generated with the help of perlbug 1.41 running under perl 5.28.0.


The following script makes my Perl crash​:

  perl -e 'use warnings FATAL => q[uninitialized]; print sort { eval { $c <=> 1 } } 1, 2'

Output​:

  panic​: restartop in perl_run



Flags​:
  category=core
  severity=none


Site configuration information for perl 5.28.0​:

Configured by strawberry-perl at Sat Jun 23 13​:56​:45 2018.

Summary of my perl5 (revision 5 version 28 subversion 0) configuration​:

  Platform​:
  osname=MSWin32
  osvers=10.0.17134.112
  archname=MSWin32-x64-multi-thread
  uname='Win32 strawberry-perl 5.28.0.1 #1 Sat Jun 23 13​:55​:45 2018 x64'
  config_args='undef'
  hint=recommended
  useposix=true
  d_sigaction=undef
  useithreads=define
  usemultiplicity=define
  use64bitint=define
  use64bitall=undef
  uselongdouble=undef
  usemymalloc=n
  default_inc_excludes_dot=define
  bincompat5005=undef
  Compiler​:
  cc='gcc'
  ccflags =' -s -O2 -DWIN32 -DWIN64 -DCONSERVATIVE -D__USE_MINGW_ANSI_STDIO -DPERL_TEXTMODE_SCRIPTS -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -fwrapv -fno-strict-aliasing -mms-bitfields'
  optimize='-s -O2'
  cppflags='-DWIN32'
  ccversion=''
  gccversion='7.1.0'
  gccosandvers=''
  intsize=4
  longsize=4
  ptrsize=8
  doublesize=8
  byteorder=12345678
  doublekind=3
  d_longlong=define
  longlongsize=8
  d_longdbl=define
  longdblsize=16
  longdblkind=3
  ivtype='long long'
  ivsize=8
  nvtype='double'
  nvsize=8
  Off_t='long long'
  lseeksize=8
  alignbytes=8
  prototype=define
  Linker and Libraries​:
  ld='g++'
  ldflags ='-s -L"C​:\STRAWB1\perl\lib\CORE" -L"C​:\STRAWB1\c\lib"'
  libpth=C​:\STRAWB1\c\lib C​:\STRAWB1\c\x86_64-w64-mingw32\lib C​:\STRAWB1\c\lib\gcc\x86_64-w64-mingw32\7.1.0
  libs= -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
  perllibs= -lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
  libc=
  so=dll
  useshrplib=true
  libperl=libperl528.a
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_win32.xs
  dlext=xs.dll
  d_dlsymun=undef
  ccdlflags=' '
  cccdlflags=' '
  lddlflags='-mdll -s -L"C​:\STRAWB
1\perl\lib\CORE" -L"C​:\STRAWB~1\c\lib"'


@​INC for perl 5.28.0​:
  C​:/Strawberry/perl/site/lib/MSWin32-x64-multi-thread
  C​:/Strawberry/perl/site/lib
  C​:/Strawberry/perl/vendor/lib
  C​:/Strawberry/perl/lib


Environment for perl 5.28.0​:
  HOME (unset)
  LANG (unset)
  LANGUAGE (unset)
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=C​:\Program Files (x86)\ActiveState Komodo IDE 11\;C​:\Python27\;C​:\Python27\Scripts;C​:\Program Files (x86)\Intel\iCLS Client\;C​:\Program Files\Intel\iCLS Client\;C​:\Windows\system32;C​:\Windows;C​:\Windows\System32\Wbem;C​:\Windows\System32\WindowsPowerShell\v1.0\;C​:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C​:\WINDOWS\system32;C​:\WINDOWS;C​:\WINDOWS\System32\Wbem;C​:\WINDOWS\System32\WindowsPowerShell\v1.0\;C​:\Strawberry\c\bin;C​:\Strawberry\perl\site\bin;C​:\Strawberry\perl\bin;C​:\Program Files\PuTTY\;C​:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C​:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C​:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C​:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;C​:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C​:\Program Files\Microsoft SQL Server\140\Tools\Binn\;C​:\Program Files\Microsoft SQL
Server\140\DTS\Binn\;C​:\WINDOWS\System32\OpenSSH\;C​:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C​:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C​:\Program Files (x86)\NVIDIA Corporation\DDS Utilities;C​:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C​:\Program Files\Git\cmd;C​:\Program Files\TortoiseGit\bin;C​:\Users\Mithaldu\AppData\Local\Microsoft\WindowsApps;c​:\Program Files\wkhtmltopdf\bin;c​:\cygwin\bin;c​:\Program Files\ffmpeg\bin;C​:\Program Files\smartmontools\bin;C​:\Users\Mithaldu\AppData\Local\Programs\Fiddler;C​:\Users\Mithaldu\AppData\Local\Microsoft\WindowsApps;c​:\Python27\;C​:\Program Files\MariaDB 10.3\bin;c​:\Program Files (x86)\GnuWin32\bin
  PERL_BADLANG (unset)
  SHELL (unset)

@p5pRT
Copy link
Author

p5pRT commented Mar 9, 2019

From @jkeenan

On Sat, 09 Mar 2019 09​:53​:47 GMT, walde.christian@​gmail.com wrote​:

This is a bug report for perl from walde.christian@​gmail.com,
generated with the help of perlbug 1.41 running under perl 5.28.0.

-----------------------------------------------------------------

The following script makes my Perl crash​:

perl -e 'use warnings FATAL => q[uninitialized]; print sort { eval {
$c <=> 1 } } 1, 2'

Output​:

panic​: restartop in perl_run

Trying this program with different versions of perl from perlbrew, I got the panic from perl-5.6.2 through perl-5.16.3. The program DWIMmed on perl-5.18.4, then once again began panicking with perl-5.20.0.

#####
$ perlbrew use perl-5.18.4;perl -e 'use warnings FATAL => q[uninitialized]; print sort { eval { $c <=> 1 } } 1, 2'
Use of uninitialized value in sort at -e line 1.

$ perlbrew use perl-5.20.0;perl -e 'use warnings FATAL => q[uninitialized]; print sort { eval { $c <=> 1 } } 1, 2'
panic​: restartop in perl_run
#####

I have not yet figured out how to bisect this. My first attempt​:

#####
perl Porting/bisect.pl --start=v5.18.0 --end=v5.20.0 --crash -- ./perl -Ilib -e 'use warnings FATAL => q[uninitialized]; print sort { eval { $c <=> 1 } } 1, 2'
#####

But I immediately got​:

#####
panic​: restartop in perl_run
HEAD is now at d7d4ece skip RC tags when checking versions diffs
good - zero exit from ./perl -Ilib -e use warnings FATAL => q[uninitialized]; print sort { eval { $c <=> 1 } } 1, 2
Runner returned 0 for end revision at Porting/bisect.pl line 233.
#####

Suggestions?

Thank you very much.

--
James E Keenan (jkeenan@​cpan.org)

@p5pRT
Copy link
Author

p5pRT commented Mar 9, 2019

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

@p5pRT
Copy link
Author

p5pRT commented Mar 9, 2019

From @Tux

On Sat, 09 Mar 2019 05​:51​:39 -0800, "James E Keenan via RT"
<perlbug-followup@​perl.org> wrote​:

On Sat, 09 Mar 2019 09​:53​:47 GMT, walde.christian@​gmail.com wrote​:

This is a bug report for perl from walde.christian@​gmail.com,
generated with the help of perlbug 1.41 running under perl 5.28.0.

-----------------------------------------------------------------

The following script makes my Perl crash​:

perl -e 'use warnings FATAL => q[uninitialized]; print sort { eval {
$c <=> 1 } } 1, 2'

Output​:

panic​: restartop in perl_run

Trying this program with different versions of perl from perlbrew, I
got the panic from perl-5.6.2 through perl-5.16.3. The program
DWIMmed on perl-5.18.4, then once again began panicking with
perl-5.20.0.

I've summarized a full run for all perl versions since 5.6.0, and it
is a bit more complicated that what you say here.

#####
$ perlbrew use perl-5.18.4;perl -e 'use warnings FATAL =>
q[uninitialized]; print sort { eval { $c <=> 1 } } 1, 2' Use of
uninitialized value in sort at -e line 1.

$ perlbrew use perl-5.20.0;perl -e 'use warnings FATAL =>
q[uninitialized]; print sort { eval { $c <=> 1 } } 1, 2' panic​:
restartop in perl_run #####

I have not yet figured out how to bisect this. My first attempt​:

#####
perl Porting/bisect.pl --start=v5.18.0 --end=v5.20.0 --crash --
./perl -Ilib -e 'use warnings FATAL => q[uninitialized]; print sort {
eval { $c <=> 1 } } 1, 2' #####

But I immediately got​:

#####
panic​: restartop in perl_run
HEAD is now at d7d4ece skip RC tags when checking versions diffs
good - zero exit from ./perl -Ilib -e use warnings FATAL =>
q[uninitialized]; print sort { eval { $c <=> 1 } } 1, 2 Runner
returned 0 for end revision at Porting/bisect.pl line 233. #####

Suggestions?

Thank you very much.

Running perl-all -e 'use warnings FATAL=>q[uninitialized];print sort{eval{$c<=>1}}1,2'

=== base/perl5.6.0 5.006 x86_64-linux
panic​: restartop
Exit status​: 256
=== base/perl5.6.1 5.006001 x86_64-linux-perlio
panic​: restartop
Exit status​: 256
=== base/tperl5.6.1 5.006001 x86_64-linux-thread-multi-ld-perlio
panic​: restartop
Exit status​: 256
=== base/perl5.6.2 5.006002 x86_64-linux-perlio
panic​: restartop
Exit status​: 256
=== base/tperl5.6.2 5.006002 x86_64-linux-thread-multi-ld-perlio
panic​: restartop
Exit status​: 256
=== base/perl5.6 5.006002 x86_64-linux-perlio
panic​: restartop
Exit status​: 256
=== base/tperl5.6 5.006002 x86_64-linux-thread-multi-ld-perlio
panic​: restartop
Exit status​: 256
=== base/perl5.8.0 5.008 x86_64-linux
Sort subroutine didn't return a numeric value at -e line 1.
Exit status​: 65280
:
: repeats
:
=== base/perl5.8.8 5.008008 x86_64-linux
Sort subroutine didn't return a numeric value at -e line 1.
Exit status​: 65280
=== base/tperl5.8.8 5.008008 x86_64-linux-thread-multi-ld
Sort subroutine didn't return a numeric value at -e line 1.
Exit status​: 65280
=== base/perl5.8.9 5.008009 x86_64-linux
panic​: restartop
=== base/tperl5.8.9 5.008009 x86_64-linux-thread-multi-ld
panic​: restartop
:
: repeats
:
=== base/tperl5.11.1 5.011001 x86_64-linux-thread-multi-ld
panic​: restartop
=== base/perl5.11.2 5.011002 x86_64-linux
panic​: restartop
perl5.11.2​: perl.c​:543​: perl_destruct​: Assertion `PL_scopestack_ix == 1' failed.
Exit status​: 6
=== base/tperl5.11.2 5.011002 x86_64-linux-thread-multi-ld
panic​: restartop
tperl5.11.2​: perl.c​:543​: perl_destruct​: Assertion `(my_perl->Iscopestack_ix) == 1' failed.
Exit status​: 6
=== base/perl5.11.3 5.011003 x86_64-linux
panic​: restartop
perl5.11.3​: perl.c​:541​: perl_destruct​: Assertion `PL_scopestack_ix == 1' failed.
Exit status​: 6
=== base/tperl5.11.3 5.011003 x86_64-linux-thread-multi-ld
panic​: restartop
tperl5.11.3​: perl.c​:541​: perl_destruct​: Assertion `(my_perl->Iscopestack_ix) == 1' failed.
Exit status​: 6
:
: repeats
:
=== base/perl5.17.1 5.017001 x86_64-linux
panic​: restartop in perl_run
perl5.17.1​: perl.c​:541​: perl_destruct​: Assertion `PL_scopestack_ix == 1' failed.
Exit status​: 6
=== base/tperl5.17.1 5.017001 x86_64-linux-thread-multi-ld
panic​: restartop in perl_run
tperl5.17.1​: perl.c​:541​: perl_destruct​: Assertion `(my_perl->Iscopestack_ix) == 1' failed.
Exit status​: 6
=== base/perl5.17.2 5.017002 x86_64-linux
Use of uninitialized value in sort at -e line 1.
Exit status​: 65280
=== base/tperl5.17.2 5.017002 x86_64-linux-thread-multi-ld
Use of uninitialized value in sort at -e line 1.
Exit status​: 65280
=== base/perl5.17.3 5.017003 x86_64-linux
Use of uninitialized value in sort at -e line 1.
Exit status​: 65280
=== base/tperl5.17.3 5.017003 x86_64-linux-thread-multi-ld
Use of uninitialized value in sort at -e line 1.
Exit status​: 65280
:
: repeats
:
=== base/perl5.19.9 5.019009 x86_64-linux
Use of uninitialized value in sort at -e line 1.
Exit status​: 65280
=== base/tperl5.19.9 5.019009 x86_64-linux-thread-multi-ld
Use of uninitialized value in sort at -e line 1.
Exit status​: 65280
=== base/perl5.19.10 5.019010 x86_64-linux
panic​: restartop in perl_run
perl5.19.10​: perl.c​:544​: perl_destruct​: Assertion `PL_scopestack_ix == 1' failed.
Exit status​: 6
=== base/tperl5.19.10 5.019010 x86_64-linux-thread-multi-ld
panic​: restartop in perl_run
tperl5.19.10​: perl.c​:544​: perl_destruct​: Assertion `(my_perl->Iscopestack_ix) == 1' failed.
Exit status​: 6
:
: repeats
:
=== base/perl5.29.6 5.029006 x86_64-linux
panic​: restartop in perl_run
perl5.29.6​: perl.c​:623​: perl_destruct​: Assertion `PL_scopestack_ix == 1' failed.
Exit status​: 6
=== base/tperl5.29.6 5.029006 x86_64-linux-thread-multi-ld
panic​: restartop in perl_run
tperl5.29.6​: perl.c​:623​: perl_destruct​: Assertion `(my_perl->Iscopestack_ix) == 1' failed.
Exit status​: 6

(I do not have the most recent development versions due to disk space)

--
H.Merijn Brand http​://tux.nl Perl Monger http​://amsterdam.pm.org/
using perl5.00307 .. 5.29 porting perl5 on HP-UX, AIX, and openSUSE
http​://mirrors.develooper.com/hpux/ http​://www.test-smoke.org/
http​://qa.perl.org http​://www.goldmark.org/jeff/stupid-disclaimers/

@p5pRT
Copy link
Author

p5pRT commented Mar 10, 2019

From Vadim.Konovalov@dell.com

The following script makes my Perl crash​:
perl -e 'use warnings FATAL => q[uninitialized]; print sort { eval { $c <=> 1 } } 1, 2'

AFAIR from reading related docs, sort comparator should "behave", but in the
above example it isn't; so no surprise perl got some "panic" branch

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

No branches or pull requests

2 participants