Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f05NiP748428 for ; Fri, 5 Jan 2001 18:44:25 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.1/8.11.1) with ESMTP id f05NifB15342; Fri, 5 Jan 2001 18:44:41 -0500 (EST) To: Alex Pilosov cc: Dave VanAuken , pgsql-general@postgresql.org Subject: Re: SHM ids (was running pgsql 7 under Jail'ed virtual machine on FreeBSD 4.2) In-reply-to: <15119.978735708@sss.pgh.pa.us> References: <15119.978735708@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Fri, 05 Jan 2001 18:01:48 -0500" Date: Fri, 05 Jan 2001 18:44:41 -0500 Message-ID: <15339.978738281@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200101/212 X-Sequence-Number: 2381 I said: > Alex Pilosov 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