BUG #1216: pgcrypto:hmac() segfaults - Mailing list pgsql-bugs

From PostgreSQL Bugs List
Subject BUG #1216: pgcrypto:hmac() segfaults
Date
Msg-id 20040812165454.CA90B5A123F@www.postgresql.com
Whole thread Raw
Responses Re: BUG #1216: pgcrypto:hmac() segfaults  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
The following bug has been logged online:

Bug reference:      1216
Logged by:          A Wu

Email address:      sunwukong@ieee.org

PostgreSQL version: 8.0 Beta

Operating system:   Linux 2.6.7-gentoo-r13 x86_64

Description:        pgcrypto:hmac() segfaults

Details:

Using a freshly initdb'd instance, compilation and installation of
contrib/pgcrypto went fine. Running 'make installcheck' forced a server
reset.

I've isolated it to this statement:

select hmac('Hi There',decode('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b',
'hex'),'md5');

though I've confirmed the decode() statement on its own is fine.

The changed sections in the pgcrypto Makefile read:

# either 'builtin', 'mhash', 'openssl'
cryptolib = openssl

# either 'builtin', 'system'
cryptsrc = system

random = dev

The regression log reads:

test init                 ... ok
test md5                  ... ok
test sha1                 ... ok
test hmac-md5             ... FAILED
test hmac-sha1            ... FAILED
test blowfish             ... FAILED
test rijndael             ... FAILED
test crypt-des            ... FAILED
test crypt-md5            ... FAILED
test crypt-blowfish       ... FAILED
test crypt-xdes           ... FAILED

The postgresql.log reads:

LOG:  server process (PID 17390) was terminated by signal 11
LOG:  terminating any other active server processes
FATAL:  the database system is in recovery mode
LOG:  all server processes terminated; reinitializing
LOG:  database system was interrupted at 2004-08-12 10:39:14 MDT
LOG:  checkpoint record is at 0/B53420
LOG:  redo record is at 0/B53420; undo record is at 0/0; shutdown FALSE
LOG:  next transaction ID: 591; next OID: 41804
LOG:  database system was not properly shut down; automatic recovery in
progress
LOG:  record with zero length at 0/B53468
LOG:  redo is not required
LOG:  database system is ready
LOG:  server process (PID 17398) was terminated by signal 11
LOG:  terminating any other active server processes
LOG:  all server processes terminated; reinitializing
LOG:  database system was interrupted at 2004-08-12 10:40:57 MDT
LOG:  checkpoint record is at 0/B53468
LOG:  redo record is at 0/B53468; undo record is at 0/0; shutdown TRUE
LOG:  next transaction ID: 591; next OID: 41804
LOG:  database system was not properly shut down; automatic recovery in
progress
LOG:  record with zero length at 0/B534B0
LOG:  redo is not required
FATAL:  the database system is starting up
LOG:  database system is ready

Finally, the system log reads:

Aug 12 10:43:00 postmaster[17398]: segfault at 0000000000000020 rip
0000002a9594d565 rsp 0000007fbfffdbe8 error 4

Basic system setup:

gcc34-amd64-2004.1
gcc-3.4.1
glibc-2.3.4.20040619-r1
autoconf-2.59-r4
automake-1.8.3
openssl-0.9.7d-r1

CHOST="x86_64-pc-linux-gnu"

Postgresql was compiled with options:

--prefix=/usr/local --enable-integer-datetimes --disable-spinlocks
--enable-thread-safety --with-tcl --with-perl --with-python --with-pam
--with-openssl

plus

CFLAGS="-O2 -pipe -march=k8 -msse2 -mfpmath=sse"
CPPFLAGS="${CFLAGS}"

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Turkish downcasting in PL/pgSQL
Next
From: ntufar
Date:
Subject: Re: Turkish downcasting in PL/pgSQL