SEGFAULT in CREATE EXTENSION related pg_init_privs
Hi
I am trying to prepare orafce for PostgreSQL 9.6.
I can successfully compile this extension, but the statement CREATE
EXTENSION fails on segfault
(gdb) bt
#0 heap_deform_tuple (tuple=tuple@entry=0x1d87e90,
tupleDesc=tupleDesc@entry=0x7f1dab9525b0, values=values@entry=0x1d87a28,
isnull=isnull@entry=0x1d882d8 "\177\177\177\177\177~\177\177") at
heaptuple.c:881
#1 0x0000000000477eda in heap_modify_tuple (tuple=tuple@entry=0x1d87e90,
tupleDesc=0x7f1dab9525b0,
replValues=replValues@entry=0x7ffc5e4076b0,
replIsnull=replIsnull@entry=0x7ffc5e407690
"",
doReplace=doReplace@entry=0x7ffc5e4076a0 "") at heaptuple.c:817
#2 0x0000000000516ddb in recordExtensionInitPriv (objoid=objoid@entry=16471,
classoid=classoid@entry=1259,
objsubid=objsubid@entry=0, new_acl=new_acl@entry=0x1d879d0) at
aclchk.c:5305
#3 0x0000000000519550 in recordExtensionInitPriv (new_acl=0x1d879d0,
objsubid=0, classoid=1259, objoid=16471) at aclchk.c:5262
#4 ExecGrant_Relation (istmt=0x7ffc5e407bc0) at aclchk.c:1965
#5 0x000000000051a325 in ExecGrantStmt_oids (istmt=istmt@entry=0x7ffc5e407bc0)
at aclchk.c:564
#6 0x000000000051bdff in ExecuteGrantStmt (stmt=stmt@entry=0x1b719f8) at
aclchk.c:549
#7 0x00000000006f88f9 in ProcessUtilitySlow
(parsetree=parsetree@entry=0x1b719f8,
queryString=queryString@entry=0x1ae30d8 "/* contrib/orafce--3.2.sql
*/\n\n-- complain if script is sourced in psql, rather than via CREATE
EXTENSION\n\n\nCREATE FUNCTION pg_catalog.trunc(value date, fmt
text)\nRETURNS date\nAS '$libdir/orafce','ora"...,
context=context@entry=PROCESS_UTILITY_QUERY, params=params@entry=0x0,
completionTag=completionTag@entry=0x0,
dest=0xc7ec40 <donothingDR>) at utility.c:1514
#8 0x00000000006f76bb in standard_ProcessUtility (parsetree=0x1b719f8,
queryString=0x1ae30d8 "/* contrib/orafce--3.2.sql */\n\n-- complain if
script is sourced in psql, rather than via CREATE EXTENSION\n\n\nCREATE
FUNCTION pg_catalog.trunc(value date, fmt text)\nRETURNS date\nAS
'$libdir/orafce','ora"...,
context=PROCESS_UTILITY_QUERY, params=0x0, dest=0xc7ec40 <donothingDR>,
completionTag=0x0) at utility.c:907
#9 0x000000000058ed9d in execute_sql_string (filename=0x1a8b0a8
"/usr/local/pgsql/share/extension/orafce--3.3.sql",
sql=0x1ae30d8 "/* contrib/orafce--3.2.sql */\n\n-- complain if script
is sourced in psql, rather than via CREATE EXTENSION\n\n\nCREATE FUNCTION
pg_catalog.trunc(value date, fmt text)\nRETURNS date\nAS
'$libdir/orafce','ora"...) at extension.c:746
#10 execute_extension_script (extensionOid=extensionOid@entry=16385,
control=control@entry=0x1a8b7d0,
from_version=from_version@entry=0x0, version=version@entry=0x1a8b8b8
"3.3", requiredSchemas=requiredSchemas@entry=0x0,
schemaName=schemaName@entry=0x1a8b7b0 "public", schemaOid=2200) at
extension.c:906
#11 0x000000000058fc72 in CreateExtensionInternal (parents=parents@entry=0x0,
stmt=<optimized out>, stmt=<optimized out>)
at extension.c:1498
#12 0x00000000005901d8 in CreateExtension (stmt=stmt@entry=0x1a556d0) at
extension.c:1556
#13 0x00000000006f8379 in ProcessUtilitySlow
(parsetree=parsetree@entry=0x1a556d0,
queryString=queryString@entry=0x1a54c78 "create extension orafce ;",
context=context@entry=PROCESS_UTILITY_TOPLEVEL,
params=params@entry=0x0, completionTag=completionTag@entry=0x7ffc5e408890
"", dest=0x1a55a58) at utility.c:1296
#14 0x00000000006f76bb in standard_ProcessUtility (parsetree=0x1a556d0,
queryString=0x1a54c78 "create extension orafce ;",
context=PROCESS_UTILITY_TOPLEVEL, params=0x0, dest=0x1a55a58,
completionTag=0x7ffc5e408890 "") at utility.c:907
#15 0x00000000006f4ed4 in PortalRunUtility (portal=0x19f7aa8,
utilityStmt=0x1a556d0, isTopLevel=<optimized out>, dest=0x1a55a58,
completionTag=0x7ffc5e408890 "") at pquery.c:1175
#16 0x00000000006f5aa6 in PortalRunMulti (portal=portal@entry=0x19f7aa8,
isTopLevel=isTopLevel@entry=1 '\001',
dest=dest@entry=0x1a55a58, altdest=altdest@entry=0x1a55a58,
completionTag=completionTag@entry=0x7ffc5e408890 "") at pquery.c:1306
#17 0x00000000006f66e6 in PortalRun (portal=portal@entry=0x19f7aa8,
count=count@entry=9223372036854775807,
isTopLevel=isTopLevel@entry=1 '\001', dest=dest@entry=0x1a55a58,
altdest=altdest@entry=0x1a55a58,
completionTag=completionTag@entry=0x7ffc5e408890 "") at pquery.c:813
#18 0x00000000006f401b in exec_simple_query (query_string=0x1a54c78 "create
extension orafce ;") at postgres.c:1094
#19 PostgresMain (argc=<optimized out>, argv=argv@entry=0x19d9590,
dbname=<optimized out>, username=<optimized out>)
at postgres.c:4059
#20 0x000000000046dbb5 in BackendRun (port=0x19fbc60) at postmaster.c:4258
#21 BackendStartup (port=0x19fbc60) at postmaster.c:3932
This is enforced by sequence of statements REVOKE, GRANT
try to add following lines to hstore--1.3.sql
CREATE VIEW public.dual AS SELECT 'X'::varchar AS dummy;
REVOKE ALL ON public.dual FROM PUBLIC;
GRANT SELECT, REFERENCES ON public.dual TO PUBLIC;
then create extension hstore enforces this error.
When I remove the REVOKE statement - all is working.
Regards
Pavel
On Thu, Apr 14, 2016 at 1:27 AM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
(gdb) bt
#0 heap_deform_tuple (tuple=tuple@entry=0x1d87e90,
tupleDesc=tupleDesc@entry=0x7f1dab9525b0, values=values@entry=0x1d87a28,
isnull=isnull@entry=0x1d882d8 "\177\177\177\177\177~\177\177") at
heaptuple.c:881
The memory appears to be freed -- CLOBBER_FREED_MEMORY stuff does this.
You might try using Valgrind, with --track-origins, which will show
where the memory was first allocated.
--
Peter Geoghegan
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
2016-04-14 10:49 GMT+02:00 Peter Geoghegan <pg@bowt.ie>:
On Thu, Apr 14, 2016 at 1:27 AM, Pavel Stehule <pavel.stehule@gmail.com>
wrote:(gdb) bt
#0 heap_deform_tuple (tuple=tuple@entry=0x1d87e90,
tupleDesc=tupleDesc@entry=0x7f1dab9525b0, values=values@entry=0x1d87a28,
isnull=isnull@entry=0x1d882d8 "\177\177\177\177\177~\177\177") at
heaptuple.c:881The memory appears to be freed -- CLOBBER_FREED_MEMORY stuff does this.
You might try using Valgrind, with --track-origins, which will show
where the memory was first allocated.
I did it, but there is nothing interesting
==00:00:00:03.519 17221== For counts of detected and suppressed errors,
rerun with: -v
==00:00:00:03.519 17221== ERROR SUMMARY: 0 errors from 0 contexts
(suppressed: 0 from 0)
==00:00:01:09.357 17228== Invalid read of size 2
==00:00:01:09.357 17228== at 0x477A15: heap_deform_tuple
(heaptuple.c:881)
==00:00:01:09.357 17228== by 0x477ED9: heap_modify_tuple
(heaptuple.c:817)
==00:00:01:09.357 17228== by 0x516DDA: recordExtensionInitPriv.part.2
(aclchk.c:5305)
==00:00:01:09.357 17228== by 0x51954F: recordExtensionInitPriv
(aclchk.c:5262)
==00:00:01:09.357 17228== by 0x51954F: ExecGrant_Relation (aclchk.c:1965)
==00:00:01:09.357 17228== by 0x51A324: ExecGrantStmt_oids (aclchk.c:564)
==00:00:01:09.357 17228== by 0x51BDFE: ExecuteGrantStmt (aclchk.c:549)
==00:00:01:09.357 17228== by 0x6F88F8: ProcessUtilitySlow.isra.5
(utility.c:1514)
==00:00:01:09.357 17228== by 0x6F76BA: standard_ProcessUtility
(utility.c:907)
==00:00:01:09.357 17228== by 0x58ED9C: execute_sql_string
(extension.c:748)
==00:00:01:09.357 17228== by 0x58ED9C: execute_extension_script.isra.5
(extension.c:908)
==00:00:01:09.357 17228== by 0x58FC71: CreateExtensionInternal.isra.6
(extension.c:1500)
==00:00:01:09.357 17228== by 0x5901D7: CreateExtension (extension.c:1558)
==00:00:01:09.357 17228== by 0x6F8378: ProcessUtilitySlow.isra.5
(utility.c:1296)
==00:00:01:09.357 17228== Address 0x7f7f7f7f7f7f7f91 is not stack'd,
malloc'd or (recently) free'd
==00:00:01:09.357 17228==.
{
<insert_a_suppression_name_here>
Memcheck:Addr2
fun:heap_deform_tuple
fun:heap_modify_tuple
fun:recordExtensionInitPriv.part.2
fun:recordExtensionInitPriv
fun:ExecGrant_Relation
fun:ExecGrantStmt_oids
fun:ExecuteGrantStmt
fun:ProcessUtilitySlow.isra.5
fun:standard_ProcessUtility
fun:execute_sql_string
fun:execute_extension_script.isra.5
fun:CreateExtensionInternal.isra.6
fun:CreateExtension
fun:ProcessUtilitySlow.isra.5
}
Regards
Pavel
Show quoted text
--
Peter Geoghegan
Pavel,
* Pavel Stehule (pavel.stehule@gmail.com) wrote:
I am trying to prepare orafce for PostgreSQL 9.6.
I can successfully compile this extension, but the statement CREATE
EXTENSION fails on segfault
Just the latest off of https://github.com/orafce/orafce ?
I took a quick look through and nothing is jumping out at me and,
unfortunately, have a lot on my plate today. I'll take a look at it
later on tonight though.
This is enforced by sequence of statements REVOKE, GRANT
try to add following lines to hstore--1.3.sql
CREATE VIEW public.dual AS SELECT 'X'::varchar AS dummy;
REVOKE ALL ON public.dual FROM PUBLIC;
GRANT SELECT, REFERENCES ON public.dual TO PUBLIC;then create extension hstore enforces this error.
When I remove the REVOKE statement - all is working.
Ok, good to know, that'll help.
Thanks!
Stephen
Hi
2016-04-14 14:26 GMT+02:00 Stephen Frost <sfrost@snowman.net>:
Pavel,
* Pavel Stehule (pavel.stehule@gmail.com) wrote:
I am trying to prepare orafce for PostgreSQL 9.6.
I can successfully compile this extension, but the statement CREATE
EXTENSION fails on segfaultJust the latest off of https://github.com/orafce/orafce ?
yes. When I commented REVOKE, then all tests passed. When you uncomment
REVOKE, then CREATE EXTENSION should to fail.
I took a quick look through and nothing is jumping out at me and,
unfortunately, have a lot on my plate today. I'll take a look at it
later on tonight though.
I understand. Now, I have workaround, so I can to continue on fixing Orafce
for 9.6, and It is not blocker for me.
Regards
Pavel
Show quoted text
This is enforced by sequence of statements REVOKE, GRANT
try to add following lines to hstore--1.3.sql
CREATE VIEW public.dual AS SELECT 'X'::varchar AS dummy;
REVOKE ALL ON public.dual FROM PUBLIC;
GRANT SELECT, REFERENCES ON public.dual TO PUBLIC;then create extension hstore enforces this error.
When I remove the REVOKE statement - all is working.
Ok, good to know, that'll help.
Thanks!
Stephen
Pavel,
* Pavel Stehule (pavel.stehule@gmail.com) wrote:
2016-04-14 14:26 GMT+02:00 Stephen Frost <sfrost@snowman.net>:
* Pavel Stehule (pavel.stehule@gmail.com) wrote:
I am trying to prepare orafce for PostgreSQL 9.6.
I can successfully compile this extension, but the statement CREATE
EXTENSION fails on segfaultJust the latest off of https://github.com/orafce/orafce ?
yes. When I commented REVOKE, then all tests passed. When you uncomment
REVOKE, then CREATE EXTENSION should to fail.
Fix pushed, please let me know if you see any further issues.
Thanks!
Stephen
2016-04-16 4:12 GMT+02:00 Stephen Frost <sfrost@snowman.net>:
Pavel,
* Pavel Stehule (pavel.stehule@gmail.com) wrote:
2016-04-14 14:26 GMT+02:00 Stephen Frost <sfrost@snowman.net>:
* Pavel Stehule (pavel.stehule@gmail.com) wrote:
I am trying to prepare orafce for PostgreSQL 9.6.
I can successfully compile this extension, but the statement CREATE
EXTENSION fails on segfaultJust the latest off of https://github.com/orafce/orafce ?
yes. When I commented REVOKE, then all tests passed. When you uncomment
REVOKE, then CREATE EXTENSION should to fail.Fix pushed, please let me know if you see any further issues.
Orafce is working without any issues now.
Thank you
Pavel
Show quoted text
Thanks!
Stephen