Re: BUG #16782: initdb coredump post-bootstrap initialization - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #16782: initdb coredump post-bootstrap initialization
Date
Msg-id 418092.1608485322@sss.pgh.pa.us
Whole thread Raw
In response to BUG #16782: initdb coredump post-bootstrap initialization  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
> (gdb) bt
> #0  pg_detoast_datum (datum=0x100000000) at fmgr.c:1741
> #1  0x0000000000808b63 in json_object (fcinfo=<optimized out>) at
> json.c:2291
> #2  0x00007f5a4b8b70bd in parse_value () from /lib64/libjansson.so.4
> #3  0x00007f5a4b8b74f6 in parse_json () from /lib64/libjansson.so.4
> #4  0x00007f5a4b8b7693 in json_loads () from /lib64/libjansson.so.4
> #5  0x00007f5a4bac1ccc in nss_request () from /lib64/libnss_http.so.2
> #6  0x00007f5a4bac22f3 in _nss_http_getpwuid_r_locked () from
> /lib64/libnss_http.so.2
> #7  0x00007f5a4bac23c7 in _nss_http_getpwuid_r () from
> /lib64/libnss_http.so.2
> #8  0x00007f5a524c052e in getpwuid_r@@GLIBC_2.2.5 () from /lib64/libc.so.6
> #9  0x00007f5a524bfc66 in getpwuid () from /lib64/libc.so.6
> #10 0x00000000008fecba in get_user_name (errstr=errstr@entry=0x7fff2f037a18)
> at username.c:40
> #11 0x00000000008fed12 in get_user_name_or_exit (progname=0x27ed010
> "postgres") at username.c:79
> #12 0x0000000000480107 in main (argc=10, argv=0x27ee0d0) at main.c:226

Hm.  If this stack trace is to be believed (something always a bit worth
questioning), then this must be a bug in libjansson.  That surely should
not be calling into random PG code.

A likely bet given the function names we see here is that
(a) "json_object" is the name of a function in libjansson as well as of
one in core Postgres, and
(b) when libjansson tries to call its function, the dynamic linker
redirects that call to the one in the host application.

I believe it's possible for (b) to be prevented if appropriate options are
used when building the library, but I do not recall details ATM.  In any
case you'd need to file a bug with the jansson package maintainer to get
it fixed.

It's interesting that we have not heard of this issue before.  I suppose
that you are running with some nonstandard stuff installed --- on my
RHEL8 box, for example, there's no libnss_http.so at all.

            regards, tom lane



pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #16782: initdb coredump post-bootstrap initialization
Next
From: Andrey Borodin
Date:
Subject: Re: CREATE INDEX CONCURRENTLY does not index prepared xact's data