-
Notifications
You must be signed in to change notification settings - Fork 571
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
PerlEmbed 5.14: sv_setsv(ERRSV, &PL_sv_undef); crashes on Linux #13230
Comments
From john.unsworth@cp.netThis is a bug report for perl from john.unsworth@cp.net, generated with the help of perlbug 1.39 running under perl 5.10.1. The C++ application calling Perl worked correctly up to Perl 5.10. However This is reported just before the core: Bizarre copy of UNKNOWN. Segmentation fault (core dumped) By adding trace lines I found that the call to sv_setsv(ERRSV, I looked into the header files and found a macro CLEAR_ERROR. At 5.10 this #define ERRSV GvSV(PL_errgv) #define CLEAR_ERRSV() STMT_START { sv_setpvn(ERRSV,"",0); if However at 5.14 it is: #define ERRSV GvSVn(PL_errgv) #define CLEAR_ERRSV() STMT_START { \ if (!GvSV(PL_errgv)) { \ sv_setpvs(GvSV(gv_add_by_type(PL_errgv, SVt_PV)), ""); \ } else if (SvREADONLY(GvSV(PL_errgv))) { \ SvREFCNT_dec(GvSV(PL_errgv)); \ GvSV(PL_errgv) = newSVpvs(""); \ } else { \ SV *const errsv = GvSV(PL_errgv); \ sv_setpvs(errsv, ""); \ if (SvMAGICAL(errsv)) { \ mg_free(errsv); \ } \ SvPOK_only(errsv); \ } \ } STMT_END So it seems that the implementation of ERRSV has changed in that at 5.14 it Flags: category=core severity=low Site configuration information for perl 5.10.1: Configured by SYSTEM at Mon Aug 24 13:48:02 2009. Summary of my perl5 (revision 5 version 10 subversion 1) 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 optimize='-MD -Zi -DNDEBUG -O1', cppflags='-DWIN32' ccversion='12.00.8804', gccversion='', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=8 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64', alignbytes=8, prototype=define Linker and Libraries: ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf libpth=\lib libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.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 Locally applied patches: ACTIVEPERL_LOCAL_PATCHES_ENTRY 32728 64-bit fix for Time::Local @INC for perl 5.10.1: C:/Perl/site/lib C:/Perl/lib . Environment for perl 5.10.1: HOME (unset) LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=C:\Program Files (x86)\Support PERL_BADLANG (unset) SHELL (unset) |
From @jkeenanOn Thu Sep 05 04:18:28 2013, john.unsworth@cp.net wrote:
Would it be possible for you to attach a file which reproduces this Thank you very much. |
The RT System itself - Status changed from 'new' to 'open' |
From @tonycozOn Thu Sep 05 04:18:28 2013, john.unsworth@cp.net wrote:
Why do you need to clear ERRSV? It should be cleared by eval_sv() or call_sv() on success (unless you While I think documenting CLEAR_ERRSV() is useful, I'm not sure where The example code Jim asked for would be useful. Tony |
From john.unsworth@cp.netHi Tony, We do use G_KEEPERR because we want to report error details. I did send a response to Jim - but the example I tried to create on Windows crashes on the call to CLEAR_ERRSV() and I don't know why. Regards, -----Original Message----- On Thu Sep 05 04:18:28 2013, john.unsworth@cp.net wrote:
Why do you need to clear ERRSV? It should be cleared by eval_sv() or call_sv() on success (unless you use G_KEEPERR). While I think documenting CLEAR_ERRSV() is useful, I'm not sure where you'd need to use it outside the core. The example code Jim asked for would be useful. Tony |
From @tonycozOn Tue Sep 10 08:40:34 2013, john.unsworth@cp.net wrote:
Sorry, the response didn't make it into request tracker for some reason, Tony |
From @cpansproutOn Tue Sep 10 15:59:32 2013, tonyc wrote:
The message is at
The ERRSV changes between 5.10 and 5.14 actually make it safer. In 5.10 If vTHX->Ierrgv is giving you zero, then the ERRSV changes are a red -- Father Chrysostomos |
From @cpansproutOn Tue Sep 10 18:17:00 2013, sprout wrote:
Could you try the same program on Linux?
Re-reading your messages, I see that vTHX->Ierrgv is only zero on Windows. On Mac OS X, that program just works. I tested the attached modified script with 5.19.5 and 5.14.4, and I get this: loaded OK Could you try reducing the app on the same architecture it crashes on? -- Father Chrysostomos |
From @cpansprout#include "EXTERN.h" int main(int argc, char* argv[]) perl_argv[0] = ("PerlCrash.exe"); PERL_SYS_INIT(&perl_argc, &perl_argv); PerlInterpreter *my_perl = perl_alloc(); perl_construct(my_perl); int iRet = perl_parse(my_perl, NULL, perl_argc, perl_argv, NULL); iRet = perl_run(my_perl); PERL_SET_CONTEXT(my_perl); PUTBACK; int ret = perl_call_pv("test::test", G_SCALAR|G_EVAL); GV* err = (vTHX->Ierrgv); return 0; |
From @bulk88On Sat Oct 26 01:05:04 2013, sprout wrote:
Attaching the 2 files from that John Unswort email post that didn't get to RT, to RT. Note, the C file is different from FC's C file in https://rt-archive.perl.org/perl5/Ticket/Display.html?id=119617#txn-1265206 . -- |
From @bulk88 |
From @bulk88On Sat Oct 26 14:25:23 2013, bulk88 wrote:
Ran on 5.19.6/blead, VC 2003 win32 32 bits threaded, got loaded OK no segvs. The c++ code does look flakey. Also the code doesn't do "#define PERL_NO_GET_CONTEXT". Removing the 2 redundant lines below and doing "#define PERL_NO_GET_CONTEXT" still doesn't crash. SV **sp = PL_stack_sp; PERL_SET_CONTEXT(my_perl); //already set somewhere where bulk88 can't quickly ID, PL_stack_sp would be uninit memory otherwise -- |
Migrated from rt.perl.org#119617 (status was 'open')
Searchable as RT119617$
The text was updated successfully, but these errors were encountered: