Skip site navigation (1) Skip section navigation (2)

Re: A note about testing EXEC_BACKEND on recent Linuxen

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: A note about testing EXEC_BACKEND on recent Linuxen
Date: 2006-02-01 15:59:39
Message-ID: 200602011559.k11Fxd114543@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Added code comment:

        /*
         *  Attach process to shared data structures.  If testing
         *  EXEC_BACKEND on Linux, you must run this as root
         *  before starting the postmaster:
         *
         *      echo 0 >/proc/sys/kernel/randomize_va_space
         *
         *  This prevents a randomized stack base address that causes
         *  child shared memory to be at a different address than
         *  the parent, making it impossible to attached to shared
         *  memory.  Return the value to '1' when finished.
         */
        CreateSharedMemoryAndSemaphores(false, 0);


---------------------------------------------------------------------------

Tom Lane wrote:
> I just wasted a couple hours trying to determine why an EXEC_BACKEND
> build would randomly fail on Fedora Core 4.  It seems the reason is that
> by default, recent Linux kernels randomize the stack base address ---
> not by a lot, but enough to cause child processes to sometimes be unable
> to attach to the shared memory segment at the same place the postmaster
> did.
> 
> You can work around this by doing (as root)
> 	echo 0 >/proc/sys/kernel/randomize_va_space
> before starting the postmaster.  You'll probably want to set it back to
> 1 when done experimenting with EXEC_BACKEND, since address randomization
> is a useful security hack.
> 
> Just seems like something that should be in our archives ...
> 
> 			regards, tom lane
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
> 
>                http://archives.postgresql.org
> 

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to

Responses

pgsql-hackers by date

Next:From: Bruce MomjianDate: 2006-02-01 16:07:44
Subject: Re: Cleaning up the INET/CIDR mess
Previous:From: Bruce MomjianDate: 2006-02-01 15:46:24
Subject: Re: Failed install - libgen.so doesn't exist

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group