[sqlsmith] Crash reading pg_stat_activity

From: Andreas Seltenreich <seltenreich(at)gmx(dot)de>
To: pgsql-hackers(at)postgresql(dot)org, rhaas(at)postgresql(dot)org
Subject: [sqlsmith] Crash reading pg_stat_activity
Date: 2016-12-27 21:01:23
Message-ID: 877f6lw0gs.fsf@ansel.ydns.eu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

testing master as of fe591f8bf6 produced a crash reading
pg_stat_activity (backtrace below). Digging around with with gdb
revealed that pgstat_get_wait_event() returned an invalid pointer for a
classId PG_WAIT_LWLOCK.

I think the culprit is dsa.c passing a pointer to memory that goes away
on dsa_free() as a name to LWLockRegisterTranche.

regards,
Andreas

Program terminated with signal SIGSEGV, Segmentation fault.
#0 strlen () at ../sysdeps/x86_64/strlen.S:106
(gdb) bt
#1 0x00000000007e03c9 in cstring_to_text (s=0x7fab18d1f954 <error: Cannot access memory at address 0x7fab18d1f954>) at varlena.c:152
#2 0x0000000000792d7c in pg_stat_get_activity (fcinfo=<optimized out>) at pgstatfuncs.c:805
#3 0x00000000005f0af5 in ExecMakeTableFunctionResult (funcexpr=0x5469f90, econtext=0x5469c80, argContext=<optimized out>, expectedDesc=0x387b2b0, randomAccess=0 '\000') at execQual.c:2216
#4 0x0000000000608633 in FunctionNext (node=node(at)entry=0x5469b68) at nodeFunctionscan.c:94
#5 0x00000000005f2c22 in ExecScanFetch (recheckMtd=0x608390 <FunctionRecheck>, accessMtd=0x6083a0 <FunctionNext>, node=0x5469b68) at execScan.c:95
#6 ExecScan (node=node(at)entry=0x5469b68, accessMtd=accessMtd(at)entry=0x6083a0 <FunctionNext>, recheckMtd=recheckMtd(at)entry=0x608390 <FunctionRecheck>) at execScan.c:180
#7 0x000000000060867f in ExecFunctionScan (node=node(at)entry=0x5469b68) at nodeFunctionscan.c:268
#8 0x00000000005eb4c8 in ExecProcNode (node=node(at)entry=0x5469b68) at execProcnode.c:449
#9 0x0000000000602cd0 in ExecLimit (node=node(at)entry=0x54697f0) at nodeLimit.c:91
#10 0x00000000005eb368 in ExecProcNode (node=node(at)entry=0x54697f0) at execProcnode.c:531
[...]

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2016-12-27 21:40:03 Re: [sqlsmith] Crash reading pg_stat_activity
Previous Message Pavel Stehule 2016-12-27 20:55:25 Re: proposal: session server side variables