Re: A note about testing EXEC_BACKEND on recent Linuxen

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: A note about testing EXEC_BACKEND on recent Linuxen
Дата
Msg-id 20060201193221.GC9888@svana.org
обсуждение исходный текст
Ответ на Re: A note about testing EXEC_BACKEND on recent Linuxen  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: A note about testing EXEC_BACKEND on recent Linuxen  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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@svana.org>   http://svana.org/kleptog/
> 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.

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: TODO-Item: B-tree fillfactor control
Следующее
От: Tom Lane
Дата:
Сообщение: Re: A note about testing EXEC_BACKEND on recent Linuxen