Skip Menu |
Report information
Id: 127773
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: randir <sergey.aleynikov [at] gmail.com>
Cc:
AdminCc:

Operating System: darwin
PatchStatus: (no value)
Severity: low
Type: core
Perl Version: (no value)
Fixed In: 5.24.0



Subject: Assertion failure in perl built with Dusecbacktrace
Download (untitled) / with headers
text/plain 4.2k
This is a bug report for perl from sergey.aleynikov@gmail.com, generated with the help of perlbug 1.40 running under perl 5.23.10. ----------------------------------------------------------------- [Please describe your issue here] ./Configure -de -Dusedevel -Dusecbacktrace -Accflags=-DUSE_C_BACKTRACE_ON_ERROR -DDEBUGGING -Doptimize=-O2 && make PERL_C_BACKTRACE_ON_ERROR=10 ./perl -e 'die "aiee"' Assertion failed: (total_bytes == (UV)(sizeof(Perl_c_backtrace_header) + frame_count * sizeof(Perl_c_backtrace_frame) + name_curr - name_base)), function Perl_get_c_backtrace, file util.c, line 6488. zsh: abort (core dumped) PERL_C_BACKTRACE_ON_ERROR=10 ./perl -e 'die "aiee"' This happens only when you build with optimization level O2 or higher. [Please do not change anything below this line] ----------------------------------------------------------------- --- Flags: category=core severity=low --- Site configuration information for perl 5.23.10: Configured by dur-randir at Wed Mar 23 20:42:06 MSK 2016. Summary of my perl5 (revision 5 version 23 subversion 10) configuration: Commit id: a66bda92c7bdd515ba8b572a123e215718a89f10 Platform: osname=darwin, osvers=13.4.0, archname=darwin-2level uname='darwin isengard.local 13.4.0 darwin kernel version 13.4.0: wed mar 18 16:20:14 pdt 2015; root:xnu-2422.115.14~1release_x86_64 x86_64 ' config_args='-de -Dusedevel -Dusecbacktrace -Accflags=-DUSE_C_BACKTRACE_ON_ERROR -DDEBUGGING -Doptimize=-O2' hint=recommended, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.9 -DUSE_C_BACKTRACE_ON_ERROR -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -DUSE_C_BACKTRACE -g -DPERL_USE_SAFE_PUTENV', optimize='-O2 -g', cppflags='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.9 -DUSE_C_BACKTRACE_ON_ERROR -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include' ccversion='', gccversion='4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc', ldflags =' -mmacosx-version-min=10.9 -fstack-protector -L/usr/local/lib' libpth=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.0/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/lib /usr/local/lib /usr/lib libs=-lpthread -lgdbm -ldbm -ldl -lm -lutil -lc -lbfd perllibs=-lpthread -ldl -lm -lutil -lc -lbfd libc=, so=dylib, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags=' -mmacosx-version-min=10.9 -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector' --- @INC for perl 5.23.10: lib /usr/local/lib/perl5/site_perl/5.23.10/darwin-2level /usr/local/lib/perl5/site_perl/5.23.10 /usr/local/lib/perl5/5.23.10/darwin-2level /usr/local/lib/perl5/5.23.10 /usr/local/lib/perl5/site_perl . --- Environment for perl 5.23.10: DYLD_LIBRARY_PATH (unset) HOME=/Users/dur-randir LANG=en_US.UTF-8 LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/Users/dur-randir/perlbrew/bin:/Users/dur-randir/perlbrew/perls/perl-blead-thr-dbg/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/texbin PERLBREW_BASHRC_VERSION=0.69 PERLBREW_HOME=/Users/dur-randir/.perlbrew PERLBREW_MANPATH=/Users/dur-randir/perlbrew/perls/perl-blead-thr-dbg/man PERLBREW_PATH=/Users/dur-randir/perlbrew/bin:/Users/dur-randir/perlbrew/perls/perl-blead-thr-dbg/bin PERLBREW_PERL=perl-blead-thr-dbg PERLBREW_ROOT=/Users/dur-randir/perlbrew PERLBREW_VERSION=0.69 PERL_BADLANG (unset) SHELL=/usr/local/bin/zsh
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 4.4k
Show quoted text
> ./Configure -de -Dusedevel -Dusecbacktrace -Accflags=- > DUSE_C_BACKTRACE_ON_ERROR -DDEBUGGING -Doptimize=-O2 && make > PERL_C_BACKTRACE_ON_ERROR=10 ./perl -e 'die "aiee"' > > Assertion failed: (total_bytes == (UV)(sizeof(Perl_c_backtrace_header) > + frame_count * sizeof(Perl_c_backtrace_frame) + name_curr - > name_base)), function Perl_get_c_backtrace, file util.c, line 6488. > zsh: abort (core dumped) PERL_C_BACKTRACE_ON_ERROR=10 ./perl -e 'die > "aiee"' > > This happens only when you build with optimization level O2 or higher.
Doesn't happen for me: PERL_C_BACKTRACE_ON_ERROR=10 ./perl -e 'die "aiee"' 0 1056e6bd8:0068 Perl_mess_sv - /Users/jhi/perl/./perl 1 1056e716e:000e Perl_croak_sv - /Users/jhi/perl/./perl 2 1056e7159:0009 Perl_die_sv - /Users/jhi/perl/./perl 3 10574ae71:0261 Perl_pp_die pp_sys.c:523 /Users/jhi/perl/./perl 4 1057029b4:0034 Perl_runops_standard - /Users/jhi/perl/./perl 5 105682b9f:03ef perl_run - /Users/jhi/perl/./perl 6 105660e6e:008e main perlmain.c:120 /Users/jhi/perl/./perl 7 7fff93c535ad:0001 start - /usr/lib/system/libdyld.dylib aiee at -e line 1. Built from http://perl5.git.perl.org/perl.git/commit/2ebde1ca18ddaa314fe6d25c75315d1019fd91b5 ./perl -Ilib -V Summary of my perl5 (revision 5 version 23 subversion 10) configuration: Platform: osname=darwin, osvers=15.3.0, archname=darwin-2level uname='darwin xxx 15.3.0 darwin kernel version 15.3.0: thu dec 10 18:40:58 pst 2015; root:xnu-3248.30.4~1release_x86_64 x86_64 ' config_args='-de -Dusedevel -Dusecbacktrace -Accflags=-DUSE_C_BACKTRACE_ON_ERROR -DDEBUGGING -Doptimize=-O2' hint=previous, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.11 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -I/opt/local/include -DPERL_USE_SAFE_PUTENV -DUSE_C_BACKTRACE_ON_ERROR -DUSE_C_BACKTRACE -g', optimize='-O2 -g', cppflags='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.11 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -I/opt/local/include' ccversion='', gccversion='4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc', ldflags =' -mmacosx-version-min=10.11 -fstack-protector-strong -L/usr/local/lib -L/opt/local/lib' libpth=/usr/local/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib /usr/lib /opt/local/lib /usr/local/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib /usr/lib libs=-lpthread -lgdbm -ldbm -ldl -lm -lutil -lc perllibs=-lpthread -ldl -lm -lutil -lc libc=, so=dylib, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags=' -mmacosx-version-min=10.11 -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib -fstack-protector-strong' Characteristics of this binary (from libperl): Compile-time options: HAS_TIMES PERLIO_LAYERS PERL_COPY_ON_WRITE PERL_DONT_CREATE_GVSV PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PERL_USE_DEVEL PERL_USE_SAFE_PUTENV USE_64_BIT_ALL USE_64_BIT_INT USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME USE_PERLIO USE_PERL_ATOF Built under darwin Compiled at Mar 23 2016 18:02:58 %ENV: PERL5LIB="/Users/jhi/.opam/system/lib/perl5:" @INC: lib /Users/jhi/.opam/system/lib/perl5 /usr/local/lib/perl5/site_perl/5.23.9/darwin-2level /usr/local/lib/perl5/site_perl/5.23.9 /usr/local/lib/perl5/5.23.9/darwin-2level /usr/local/lib/perl5/5.23.9 .
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 5.5k
On Wed Mar 23 11:24:10 2016, randir wrote: Show quoted text
> This is a bug report for perl from sergey.aleynikov@gmail.com, > generated with the help of perlbug 1.40 running under perl 5.23.10. > > > ----------------------------------------------------------------- > [Please describe your issue here] > > ./Configure -de -Dusedevel -Dusecbacktrace -Accflags=- > DUSE_C_BACKTRACE_ON_ERROR -DDEBUGGING -Doptimize=-O2 && make > PERL_C_BACKTRACE_ON_ERROR=10 ./perl -e 'die "aiee"' > > Assertion failed: (total_bytes == (UV)(sizeof(Perl_c_backtrace_header) > + frame_count * sizeof(Perl_c_backtrace_frame) + name_curr - > name_base)), function Perl_get_c_backtrace, file util.c, line 6488. > zsh: abort (core dumped) PERL_C_BACKTRACE_ON_ERROR=10 ./perl -e 'die > "aiee"' > > This happens only when you build with optimization level O2 or higher. > > [Please do not change anything below this line] > ----------------------------------------------------------------- > --- > Flags: > category=core > severity=low > --- > Site configuration information for perl 5.23.10: > > Configured by dur-randir at Wed Mar 23 20:42:06 MSK 2016. > > Summary of my perl5 (revision 5 version 23 subversion 10) > configuration: > Commit id: a66bda92c7bdd515ba8b572a123e215718a89f10 > Platform: > osname=darwin, osvers=13.4.0, archname=darwin-2level > uname='darwin isengard.local 13.4.0 darwin kernel version 13.4.0: > wed mar 18 16:20:14 pdt 2015; root:xnu-2422.115.14~1release_x86_64 > x86_64 ' > config_args='-de -Dusedevel -Dusecbacktrace -Accflags=- > DUSE_C_BACKTRACE_ON_ERROR -DDEBUGGING -Doptimize=-O2'
I don't know whether you intended this to be a Darwin-specific bug but, in any event, I could not reproduce in on Linux x86_64. ##### $> ./Configure -de -Dusedevel -Dusecbacktrace -Accflags=-DUSE_C_BACKTRACE_ON_ERROR -DDEBUGGING -Doptimize=-O2 && make -j8 $> PERL_C_BACKTRACE_ON_ERROR=10 ./perl -e 'die "aiee"' 0 4da2ab:001b Perl_dump_c_backtrace - ./perl 1 4da53f:017f Perl_mess_sv - ./perl 2 4daa10:0010 Perl_croak_sv - ./perl 3 4daa5e:000e Perl_die_sv - ./perl 4 582c92:0172 Perl_pp_die - ./perl 5 4d67f2:0032 Perl_runops_debug - ./perl 6 450d68:05a8 perl_run - ./perl 7 420c95:0105 main - ./perl 8 7f38b4a6eec5:00f5 __libc_start_main - /lib/x86_64-linux-gnu/libc.so.6 9 420ccd - - ./perl aiee at -e line 1. $> ./perl -Ilib -V Summary of my perl5 (revision 5 version 23 subversion 10) configuration: Commit id: 2ebde1ca18ddaa314fe6d25c75315d1019fd91b5 Platform: osname=linux, osvers=3.13.0-83-generic, archname=x86_64-linux uname='linux zareason 3.13.0-83-generic #127-ubuntu smp fri mar 11 00:25:37 utc 2016 x86_64 x86_64 x86_64 gnulinux ' config_args='-de -Dusedevel -Dusecbacktrace -Accflags=-DUSE_C_BACKTRACE_ON_ERROR -DDEBUGGING -Doptimize=-O2' hint=recommended, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-DUSE_C_BACKTRACE_ON_ERROR -fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -DUSE_C_BACKTRACE -g -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2 -g', cppflags='-DUSE_C_BACKTRACE_ON_ERROR -fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include' ccversion='', gccversion='4.8.4', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc', ldflags =' -fstack-protector -L/usr/local/lib' libpth=/usr/local/lib /usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed /usr/include/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib/../lib /usr/lib/x86_64-linux-gnu /usr/lib/../lib /lib /lib64 /usr/lib64 libs=-lpthread -lnsl -ldb -ldl -lm -lcrypt -lutil -lc perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc libc=libc-2.19.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.19' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector' Characteristics of this binary (from libperl): Compile-time options: DEBUGGING HAS_TIMES PERLIO_LAYERS PERL_COPY_ON_WRITE PERL_DONT_CREATE_GVSV PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PERL_USE_DEVEL USE_64_BIT_ALL USE_64_BIT_INT USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME USE_PERLIO USE_PERL_ATOF Built under linux Compiled at Mar 23 2016 19:33:12 %ENV: PERLBREW_BASHRC_VERSION="0.67" PERLBREW_HOME="/home/jkeenan/.perlbrew" PERLBREW_MANPATH="/home/jkeenan/perl5/perlbrew/perls/perl-5.22.0/man" PERLBREW_PATH="/home/jkeenan/perl5/perlbrew/bin:/home/jkeenan/perl5/perlbrew/perls/perl-5.22.0/bin" PERLBREW_PERL="perl-5.22.0" PERLBREW_ROOT="/home/jkeenan/perl5/perlbrew" PERLBREW_VERSION="0.67" PERL_WORKDIR="gitwork/perl" @INC: lib /usr/local/lib/perl5/site_perl/5.23.10/x86_64-linux /usr/local/lib/perl5/site_perl/5.23.10 /usr/local/lib/perl5/5.23.10/x86_64-linux /usr/local/lib/perl5/5.23.10 . ##### -- James E Keenan (jkeenan@cpan.org)
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 3.6k
I can reproduce this: $ PERL_C_BACKTRACE_ON_ERROR=10 ./perl -e 'die "aiee"' Assertion failed: (total_bytes == (UV)(sizeof(Perl_c_backtrace_header) + frame_count * sizeof(Perl_c_backtrace_frame) + name_curr - name_base)), function Perl_get_c_backtrace, file util.c, line 6488. Abort trap: 6 $ uname -a Darwin vovkasm-macbook.home 15.4.0 Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64 x86_64 $ cc -v pple LLVM version 7.3.0 (clang-703.0.29) Target: x86_64-apple-darwin15.4.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin $ ./perl -Ilib -V Summary of my perl5 (revision 5 version 23 subversion 10) configuration: Commit id: 2ebde1ca18ddaa314fe6d25c75315d1019fd91b5 Platform: osname=darwin, osvers=15.4.0, archname=darwin-2level uname='darwin vovkasm-macbook.home 15.4.0 darwin kernel version 15.4.0: fri feb 26 22:08:05 pst 2016; root:xnu-3248.40.184~3release_x86_64 x86_64 ' config_args='-de -Dusedevel -Dusecbacktrace -Accflags=-DUSE_C_BACKTRACE_ON_ERROR -DDEBUGGING -Doptimize=-O2' hint=recommended, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=undef use64bitint=define, use64bitall=define, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.11 -DUSE_C_BACKTRACE_ON_ERROR -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -DUSE_C_BACKTRACE -g -DPERL_USE_SAFE_PUTENV', optimize='-O2 -g', cppflags='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.11 -DUSE_C_BACKTRACE_ON_ERROR -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include' ccversion='', gccversion='4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.29)', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678, doublekind=3 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16, longdblkind=3 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc', ldflags =' -mmacosx-version-min=10.11 -fstack-protector-strong -L/usr/local/lib' libpth=/usr/local/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.3.0/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib /usr/lib libs=-lpthread -lgdbm -ldbm -ldl -lm -lutil -lc perllibs=-lpthread -ldl -lm -lutil -lc libc=, so=dylib, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' ' cccdlflags=' ', lddlflags=' -mmacosx-version-min=10.11 -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector-strong' Characteristics of this binary (from libperl): Compile-time options: DEBUGGING HAS_TIMES PERLIO_LAYERS PERL_COPY_ON_WRITE PERL_DONT_CREATE_GVSV PERL_HASH_FUNC_ONE_AT_A_TIME_HARD PERL_MALLOC_WRAP PERL_PRESERVE_IVUV PERL_USE_DEVEL PERL_USE_SAFE_PUTENV USE_64_BIT_ALL USE_64_BIT_INT USE_LARGE_FILES USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE USE_LOCALE_NUMERIC USE_LOCALE_TIME USE_PERLIO USE_PERL_ATOF Built under darwin Compiled at Mar 24 2016 16:23:02 @INC: lib /usr/local/lib/perl5/site_perl/5.23.10/darwin-2level /usr/local/lib/perl5/site_perl/5.23.10 /usr/local/lib/perl5/5.23.10/darwin-2level /usr/local/lib/perl5/5.23.10 /usr/local/lib/perl5/site_perl .
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 131b
Attached patch fixes problem for me. It is a proof of concept. But code here is really ugly. For example mac part has memory leaks.
Subject: fix.diff
Download fix.diff
application/octet-stream 1.6k

Message body not shown because it is not plain text.

RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 464b
On Thu Mar 24 14:06:41 2016, vovkasm wrote: Show quoted text
> Attached patch fixes problem for me. It is a proof of concept. But > code here is really ugly. For example mac part has memory leaks.
Thanks for the proof of concept (can you describe what you fixed in that?) Also, can you detail what leaks you see? valgrind isn't finding any from this code (there are plenty of "known" leaks which Perl chooses to allocate but never deallocate, with the default destruct level).
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.2k
On Fri Mar 25 05:57:40 2016, jhi wrote: Show quoted text
> Thanks for the proof of concept (can you describe what you fixed in > that?)
1. (First chunk in diff) Fixes bad parsing of `atos` output. A. fread returns count of bytes. B. First argument to atos_parse expected to be a pointer to last char in buffer. C. Parsing in atos_parse progress backward from this char. First it skips spaces until ')' etc... Before the patch, atos_parse got position after last char. And most probably it was not space char and not ')', so atos_parse was not worked. 2. (Second chunk in diff) Fixes assertion. If dladdr return 0, frame_count was not changed, but total_bytes was incremented by sizeof(Perl_c_backtrace_frame). Then (in case dladdr return 0) frame processing cycle ended with right frame_count value, but wrong total_bytes value, part of which should be <number of frames> * sizeof(Perl_c_backtrace_frame), bug was (<number of frames> + 1) * sizeof(Perl_c_backtrace_frame). Show quoted text
> > Also, can you detail what leaks you see? valgrind isn't finding any > from this code (there are plenty of "known" leaks which Perl chooses > to allocate but never deallocate, with the default destruct level).
No, I can see where elements of source_names array deallocated now. Sorry, I was very angry in trying to understand this code.
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.1k
On Fri Mar 25 06:39:48 2016, vovkasm wrote: Show quoted text
> On Fri Mar 25 05:57:40 2016, jhi wrote:
> > Thanks for the proof of concept (can you describe what you fixed in > > that?)
> > 1. (First chunk in diff) Fixes bad parsing of `atos` output. > A. fread returns count of bytes. > B. First argument to atos_parse expected to be a pointer to last char > in buffer. > C. Parsing in atos_parse progress backward from this char. First it > skips spaces until ')' etc... > Before the patch, atos_parse got position after last char. And most > probably it was not space char and not ')', so atos_parse was not > worked. > > 2. (Second chunk in diff) Fixes assertion. > If dladdr return 0, frame_count was not changed, but total_bytes was > incremented by sizeof(Perl_c_backtrace_frame). Then (in case dladdr > return 0) frame processing cycle ended with right frame_count value, > but wrong total_bytes value, part of which should be <number of
> frames> * sizeof(Perl_c_backtrace_frame), bug was (<number of frames>
> + 1) * sizeof(Perl_c_backtrace_frame).
Even though you said your fix was "in progress", it looks fine to me, so unless you have objections, I will go ahead and apply it.
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.1k
On Fri Mar 25 06:39:48 2016, vovkasm wrote: Show quoted text
> On Fri Mar 25 05:57:40 2016, jhi wrote:
> > Thanks for the proof of concept (can you describe what you fixed in > > that?)
> > 1. (First chunk in diff) Fixes bad parsing of `atos` output. > A. fread returns count of bytes. > B. First argument to atos_parse expected to be a pointer to last char > in buffer. > C. Parsing in atos_parse progress backward from this char. First it > skips spaces until ')' etc... > Before the patch, atos_parse got position after last char. And most > probably it was not space char and not ')', so atos_parse was not > worked. > > 2. (Second chunk in diff) Fixes assertion. > If dladdr return 0, frame_count was not changed, but total_bytes was > incremented by sizeof(Perl_c_backtrace_frame). Then (in case dladdr > return 0) frame processing cycle ended with right frame_count value, > but wrong total_bytes value, part of which should be <number of
> frames> * sizeof(Perl_c_backtrace_frame), bug was (<number of frames>
> + 1) * sizeof(Perl_c_backtrace_frame).
Even though you said your fix was "in progress", it looks fine to me, so unless you have objections, I will go ahead and apply it.
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.3k
On Sat Mar 26 06:15:33 2016, jhi wrote: Show quoted text
> On Fri Mar 25 06:39:48 2016, vovkasm wrote:
> > On Fri Mar 25 05:57:40 2016, jhi wrote:
> > > Thanks for the proof of concept (can you describe what you fixed in > > > that?)
> > > > 1. (First chunk in diff) Fixes bad parsing of `atos` output. > > A. fread returns count of bytes. > > B. First argument to atos_parse expected to be a pointer to last > > char > > in buffer. > > C. Parsing in atos_parse progress backward from this char. First it > > skips spaces until ')' etc... > > Before the patch, atos_parse got position after last char. And most > > probably it was not space char and not ')', so atos_parse was not > > worked. > > > > 2. (Second chunk in diff) Fixes assertion. > > If dladdr return 0, frame_count was not changed, but total_bytes was > > incremented by sizeof(Perl_c_backtrace_frame). Then (in case dladdr > > return 0) frame processing cycle ended with right frame_count value, > > but wrong total_bytes value, part of which should be <number of
> > frames> * sizeof(Perl_c_backtrace_frame), bug was (<number of frames>
> > + 1) * sizeof(Perl_c_backtrace_frame).
> > Even though you said your fix was "in progress", it looks fine to me, > so unless you have objections, I will go ahead and apply it.
No objections, but it would be good if someone else will test this with another version of mac os and/or xcode.
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 383b
Show quoted text
> > Even though you said your fix was "in progress", it looks fine to me, > > so unless you have objections, I will go ahead and apply it.
> > No objections, but it would be good if someone else will test this > with another version of mac os and/or xcode.
Well, I can test it with what I got, but I can only test "does it break anything" because for me the code doesn't crash.
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 709b
On Sat Mar 26 16:01:04 2016, jhi wrote: Show quoted text
>
> > > Even though you said your fix was "in progress", it looks fine to > > > me, > > > so unless you have objections, I will go ahead and apply it.
> > > > No objections, but it would be good if someone else will test this > > with another version of mac os and/or xcode.
> > Well, I can test it with what I got, but I can only test "does it > break anything" because for me the code doesn't crash.
Looking at the patch: in the second chunk, shouldn't/couldn't the zeroing of stuff still happen before the dladdr() call? I understand why the adding to the total_bytes needs to happen only if dladdr succeeded, but the zeroing probably should happen either way.
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 913b
On Sat Mar 26 16:23:31 2016, jhi wrote: Show quoted text
> On Sat Mar 26 16:01:04 2016, jhi wrote:
> >
> > > > Even though you said your fix was "in progress", it looks fine to > > > > me, > > > > so unless you have objections, I will go ahead and apply it.
> > > > > > No objections, but it would be good if someone else will test this > > > with another version of mac os and/or xcode.
> > > > Well, I can test it with what I got, but I can only test "does it > > break anything" because for me the code doesn't crash.
> > Looking at the patch: in the second chunk, shouldn't/couldn't the > zeroing of stuff still happen before the dladdr() call? I understand > why the adding to the total_bytes needs to happen only if dladdr > succeeded, but the zeroing probably should happen either way.
Could you try blead with the -Dusecbacktrace at http://perl5.git.perl.org/perl.git/commit/4d00a3198aa6950e874328ec431d15c821382cce ?
To: perlbug-followup [...] perl.org
From: Vladimir Timofeev <vovkasm [...] gmail.com>
Date: Sun, 27 Mar 2016 20:09:12 +0300
Subject: Re: [perl #127773] Assertion failure in perl built with Dusecbacktrace
Download (untitled) / with headers
text/plain 859b
On Sun, Mar 27, 2016 at 7:14 PM, Jarkko Hietaniemi via RT <perlbug-followup@perl.org> wrote: Show quoted text
>> >> Looking at the patch: in the second chunk, shouldn't/couldn't the >> zeroing of stuff still happen before the dladdr() call? I understand >> why the adding to the total_bytes needs to happen only if dladdr >> succeeded, but the zeroing probably should happen either way.
>
No, because those arrays (object_name_sizes, source_names, source_names_sizes and source_lines) not accessed with index greater skip + frame_count - 1. But zeroing them will not do any harm of course. Moreover, if we want to be totally safe, we can use Newxz to allocate them. Show quoted text
> Could you try blead with the -Dusecbacktrace at http://perl5.git.perl.org/perl.git/commit/4d00a3198aa6950e874328ec431d15c821382cce ? >
Yes, it works. Thank you! -- Vladimir Timofeev <vovkasm@gmail.com>
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 956b
On Sun Mar 27 10:09:47 2016, vovkasm wrote: Show quoted text
> On Sun, Mar 27, 2016 at 7:14 PM, Jarkko Hietaniemi via RT > <perlbug-followup@perl.org> wrote:
> >> > >> Looking at the patch: in the second chunk, shouldn't/couldn't the > >> zeroing of stuff still happen before the dladdr() call? I > >> understand > >> why the adding to the total_bytes needs to happen only if dladdr > >> succeeded, but the zeroing probably should happen either way.
> >
> No, because those arrays (object_name_sizes, source_names, > source_names_sizes and source_lines) not accessed with index greater > skip + frame_count - 1. But zeroing them will not do any harm of > course. Moreover, if we want to be totally safe, we can use Newxz to > allocate them. >
> > Could you try blead with the -Dusecbacktrace at > > http://perl5.git.perl.org/perl.git/commit/4d00a3198aa6950e874328ec431d15c821382cce > > ? > >
> Yes, it works. Thank you!
Marking as resolved, then. Thanks for testing.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org