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

Re: A note about testing EXEC_BACKEND on recent Linuxen

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: A note about testing EXEC_BACKEND on recent Linuxen
Date: 2006-02-01 19:32:21
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
On Wed, Feb 01, 2006 at 10:59:39AM -0500, Bruce Momjian wrote:
>          *  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.

Hmm, are there no other ways that this problem can manifest itself?
ISTM that we're relying completely on the kernel to map it in the same
place each time. Maybe one day someone changes the startup procedure to
allocate some more memory and it gets mapped somewhere else.

A better solution would be to explicitly map it in the child processes.
Basically, store the shared memory base at the beginning of the shared
memory block. Then when the child maps it it can verify the location.
It if doesn't match, unmap and remap at the right place.

The first half should probably at least be implemented to detect the
situation (ERROR: Shared memory block mapped at wrong location). But
given that you could probably solve the problem completely... Ofcourse,
there's the risk the child has already allocated memory where it should
be (the randomize space flag might cause this).

Have a nice day,
Martijn van Oosterhout   <kleptog(at)svana(dot)org>
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

In response to


pgsql-hackers by date

Next:From: Tom LaneDate: 2006-02-01 19:38:08
Subject: Re: A note about testing EXEC_BACKEND on recent Linuxen
Previous:From: Bruce MomjianDate: 2006-02-01 18:32:24
Subject: Re: TODO-Item: B-tree fillfactor control

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