pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alex Pilosov <alex@pilosoft.com>
Cc: Dave VanAuken <dave@hawk-systems.com>
Cc: pgsql-general@postgresql.org
Subject: Re: SHM ids (was running pgsql 7 under Jail'ed virtual machine on FreeBSD 4.2)
Date: Fri, 05 Jan 2001 18:44:41 -0500
Message-ID: <15339.978738281@sss.pgh.pa.us> (raw)
In-Reply-To: <15119.978735708@sss.pgh.pa.us>
References: <Pine.BSO.4.10.10101051530300.31095-100000@spider.pilosoft.com>
	<15119.978735708@sss.pgh.pa.us>

I said:
> Alex Pilosov <alex@pilosoft.com> writes:
>> I'd suggest you do this: add a global backend_shmid_offset in ipc.c,
>> initialized to current default, and an option to postgres to put a value
>> there. 

> Don't waste your time.  This issue is gone in current sources.  See
> IpcMemoryCreate and IpcSemaphoreCreate in src/backend/storage/ipc/ipc.c.

Actually, now that I think about it, you might still have a problem if
a "jail" is what I think it is.  The current code will step past an
existing shmem segment if it appears to be a non-Postgres memory segment
or if it appears to belong to another running postmaster.  However, the
test to see if the segment owner appears to be alive is

        /*
         * If the creator PID is my own PID or does not belong to any
         * extant process, it's safe to zap it.
         */
        if (hdr->creatorPID != getpid())
        {
            if (kill(hdr->creatorPID, 0) == 0 ||
                errno != ESRCH)
            {
		// segment belongs to a live postmaster, so continue
	    }
	}

So the question for you is, what will happen if kill() is given a PID
belonging to a process that's in a different "jail"?  Will it return
some kind of permission failure, or will it claim that there is no
such PID (ie, return ESRCH)?  If the latter, we still have a problem ...

			regards, tom lane



view thread (7+ messages)  latest in thread

Message-ID: <15339.978738281@sss.pgh.pa.us>
Permalink:  ../15339.978738281@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/15339.978738281@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: tgl@sss.pgh.pa.us, alex@pilosoft.com, dave@hawk-systems.com, pgsql-general@postgresql.org
  Subject: Re: SHM ids (was running pgsql 7 under Jail'ed virtual machine on FreeBSD 4.2)
  In-Reply-To: <15339.978738281@sss.pgh.pa.us>
  References: <Pine.BSO.4.10.10101051530300.31095-100000@spider.pilosoft.com> <15119.978735708@sss.pgh.pa.us> <15339.978738281@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox