Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VRlVI-00019y-58 for pgsql-bugs@arkaria.postgresql.org; Thu, 03 Oct 2013 16:11:52 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VRlVG-0004jP-TA for pgsql-bugs@arkaria.postgresql.org; Thu, 03 Oct 2013 16:11:50 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VRlVE-0004jG-UV for pgsql-bugs@postgresql.org; Thu, 03 Oct 2013 16:11:49 +0000 Received: from moutng.kundenserver.de ([212.227.17.8]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VRlV8-0005O2-2o for pgsql-bugs@postgresql.org; Thu, 03 Oct 2013 16:11:48 +0000 Received: from anarazel.de (p5DDC6883.dip0.t-ipconnect.de [93.220.104.131]) by mrelayeu.kundenserver.de (node=mrbap3) with ESMTP (Nemesis) id 0M4HbP-1VjZGh1knr-00rsui; Thu, 03 Oct 2013 18:11:40 +0200 Received: by anarazel.de (Postfix, from userid 1000) id 9158A101AB0; Thu, 3 Oct 2013 18:11:39 +0200 (CEST) Date: Thu, 3 Oct 2013 18:11:39 +0200 From: Andres Freund To: PostgreSQL Bugs Subject: abort()/segfault when starting postgres in inaccessible CWD Message-ID: <20131003161139.GA28301@awork2.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Provags-ID: V02:K0:DKin80bm+Npi+T9c2On7oTMK6yc7xHBX/YXTACyDhOQ VVQB1EqmjhtJ+ArCPvCpqcul93CesonEcIPJ2N+1EMaoysyEqg 2R3Sq5AVaGzG+oHTq5tCW4AwfssuBMd2txWIucut8RQP4G/KUH S+/kAdZzoA1BYhFBxB/u70PB0h7f1QrSOfcS5lLMW0P8iBCoYz 2RDlRg/ngX6C0TKylXq1WoxmR6T6JCf6zXLuzjJG0i9Uktbku5 x8r4S75xLR7K0SzzwWveFJXHTb0idSZxE2jOFCYLbBgXzbnKwu OWzYWkRb40F3TpD6VTdX51ENvUHbyz/cxdH+YA1XAfUsO3YPY8 Yfgt4MHPQ9bpwTXhBAQi8OiIM1kL87kw/LDPjiwts X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Hi, Starting postgres with a CWD that's not readable will trigger an Assert and if those are disabled it presumably will segfault. #0 0x00007ffff75621e5 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 #1 0x00007ffff7565398 in __GI_abort () at abort.c:90 #2 0x000000000089031d in ExceptionalCondition ( conditionName=0xa6e530 "!(((CurrentMemoryContext) != ((void *)0) && (((((const Node*)((CurrentMemoryContext)))->type) == T_AllocSetContext))))", errorType=0xa6e2c9 "BadArgument", fileName=0xa6e240 "/home/andres/src/postgresql/src/backend/utils/mmgr/mcxt.c", lineNumber=649) at /home/andres/src/postgresql/src/backend/utils/error/assert.c:54 #3 0x00000000008bc206 in palloc (size=1024) at /home/andres/src/postgresql/src/backend/utils/mmgr/mcxt.c:649 #4 0x00000000006597b2 in initStringInfo (str=0x7fffffffc410) at /home/andres/src/postgresql/src/backend/lib/stringinfo.c:50 #5 0x0000000000896383 in expand_fmt_string (fmt=0xa8d3e8 "could not change directory to \"%s\": %s", edata=0xd587e0 ) at /home/andres/src/postgresql/src/backend/utils/error/elog.c:3167 #6 0x0000000000892c52 in elog_finish (elevel=15, fmt=0xa8d3e8 "could not change directory to \"%s\": %s") at /home/andres/src/postgresql/src/backend/utils/error/elog.c:1297 #7 0x00000000008d932a in resolve_symlinks (path=0x7fffffffdad0 "/home/andres/build/postgres/dev-assert/vpath/src/backend/postgres") at /home/andres/src/postgresql/src/port/exec.c:293 #8 0x00000000008d8e10 in find_my_exec (argv0=0xd60bb0 "/home/andres/build/postgres/dev-assert/vpath/src/backend/postgres", retpath=0x7fffffffdad0 "/home/andres/build/postgres/dev-assert/vpath/src/backend/postgres") at /home/andres/src/postgresql/src/port/exec.c:144 #9 0x00000000008d96aa in set_pglocale_pgservice (argv0=0xd60bb0 "/home/andres/build/postgres/dev-assert/vpath/src/backend/postgres", app=0xa05440 "postgres-9.4") at /home/andres/src/postgresql/src/port/exec.c:561 #10 0x0000000000668932 in main (argc=21, argv=0xd60af0) at /home/andres/src/postgresql/src/backend/main/main.c:98 So, the problem is that we're calling set_pglocale_pgservice() which indirectly can call elog() long before we've initialized memory contexts. To reproduce do something like: # become root su # change into root-only directory cd /root # switch user, without changing directory su postgres # execute postgres /path/to/postgres -D frakbar Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs