Re: plperl segfault in plperl_trusted_init() on kfreebsd

From: Christoph Berg <cb(at)df7cb(dot)de>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Stephen Frost <sfrost(at)snowman(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, 704802(at)bugs(dot)debian(dot)org, debian-bsd(at)lists(dot)debian(dot)org, perl(at)packages(dot)debian(dot)org
Subject: Re: plperl segfault in plperl_trusted_init() on kfreebsd
Date: 2013-05-22 00:33:44
Message-ID: 20130522003343.GA32556@msgid.df7cb.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Re: Andrew Dunstan 2013-05-17 <51964770(dot)6070405(at)dunslane(dot)net>
> I have reproduced this. It happens with both the distro perl and a
> home-built perl 5.14. AFAICT this is a Perl bug. Any reference at
> all to ERRSV at the point this occurs causes a core dump, even just
> assigning it to a local SV * variable. Maybe you should take this up
> with the Perl people. It certainly seems mysterious that this should
> only occur on this platform.

I've just tried to look into this but got lost in chasing about 5
nested layers of ERRSV #defines. :-/

The crash also happens with libperl5.18 (5.18.0-1) on unstable/kfreebsd-amd64.

./configure --with-perl; make; cd src/pl/perl; make clean

postgresql-9.3/src/pl/plperl $ make PROFILE="-g -O0"
'/usr/bin/perl' ./text2macro.pl --strip='^(\#.*|\s*)$' plc_perlboot.pl plc_trusted.pl > perlchunks.h
'/usr/bin/perl' plperl_opmask.pl plperl_opmask.h
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O0 -fpic -I. -I. -I../../../src/include -D_GNU_SOURCE -I/usr/lib/perl/5.18/CORE -c -o plperl.o plperl.c
'/usr/bin/perl' /usr/share/perl/5.18/ExtUtils/xsubpp -typemap /usr/share/perl/5.18/ExtUtils/typemap SPI.xs >SPI.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O0 -fpic -I. -I. -I../../../src/include -D_GNU_SOURCE -I/usr/lib/perl/5.18/CORE -c -o SPI.o SPI.c
'/usr/bin/perl' /usr/share/perl/5.18/ExtUtils/xsubpp -typemap /usr/share/perl/5.18/ExtUtils/typemap Util.xs >Util.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O0 -fpic -I. -I. -I../../../src/include -D_GNU_SOURCE -I/usr/lib/perl/5.18/CORE -c -o Util.o Util.c
gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -O0 -fpic -shared -o plperl.so plperl.o SPI.o Util.o -L../../../src/port -L../../../src/common -Wl,--as-needed -Wl,-rpath,'/usr/lib/perl/5.18/CORE',--enable-new-dtags -g -O0 -fstack-protector -L/usr/local/lib -L/usr/lib/perl/5.18/CORE -lperl -ldl -lm -lpthread -lc -lcrypt

postgresql-9.3/src/pl/plperl $ make check
[...]
../../../src/test/regress/pg_regress --inputdir=. --temp-install=./tmp_check --top-builddir=../../.. --dbname=pl_regression --load-extension=plperl --load-extension=plperlu plperl plperl_lc plperl_trigger plperl_shared plperl_elog plperl_util plperl_init plperlu plperl_array plperl_plperlu
[...]
============== running regression test queries ==============
test plperl ... FAILED (test process exited with exit code 2)
[...]

#0 0x000000080a4274ed in plperl_trusted_init () at plperl.c:937
937 if (SvTRUE(ERRSV))
#1 0x000000080a42602d in select_perl_context (trusted=1 '\001') at plperl.c:600
#2 0x000000080a430cb1 in compile_plperl_function (fn_oid=49152, is_trigger=0 '\000') at plperl.c:2661
#3 0x000000080a42ca4d in plperl_validator (fcinfo=0x7fffffffbeb0) at plperl.c:1900
#4 0x000000000071ffb6 in OidFunctionCall1Coll ()
#5 0x00000000004ec3b7 in ProcedureCreate ()
#6 0x000000000054c4ee in CreateFunction ()
#7 0x000000000065889f in ProcessUtilitySlow.isra.2 ()
#8 0x0000000000657b4c in standard_ProcessUtility ()
#9 0x0000000000655467 in PortalRunUtility ()
#10 0x0000000000656055 in PortalRunMulti ()
#11 0x0000000000656b42 in PortalRun ()
#12 0x0000000000653ef3 in PostgresMain ()
#13 0x0000000000464471 in ServerLoop ()
#14 0x00000000006144e1 in PostmasterMain ()
#15 0x0000000000464cab in main ()

Christoph
--
cb(at)df7cb(dot)de | http://www.df7cb.de/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2013-05-22 02:18:21 MVCC catalog access
Previous Message Gavin Flower 2013-05-21 21:41:17 Re: SET work_mem = '1TB';