Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Jun 2015 07:24:21 +0900
From:      kikuchan <kikuchan@uranus.dti.ne.jp>
To:        freebsd-jail@freebsd.org
Subject:   [patch] separate SysV IPC namespace for jail
Message-ID:  <CAG40kxFFnfvbLbqVprPC0oZ%2BnbKDYGxdvgd-vxWXFfN%2B3NQ0_A@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
--001a114e5992f93c6d0517ccc075
Content-Type: text/plain; charset=UTF-8

Hello,

I want to run multiple instances of PostgreSQL with jail.

Changing UID is not suitable for my case,
so I created a simple patch for stable/10 to separate SysV IPC
namespace for each jail.

In contrast to https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=48471 ,
this patch comes with;
 - All objects are visible by ipcs(1) whether in jails or not.
 - Trying to access the objects beyond the jail will be rejected with EACCES.
 - Treat (key_t, prison) pair as the key for a named object.
 - Very simple implementation; I just added to check
msqkptr->cred->cr_prison == td->td_ucred->cr_prison, for example.

Is this approach suitable for FreeBSD kernel?

If you find it is useful, or bugs, please let me know.

P.S.
 There is no way to know from userland which jails own the objects, so far.

Regards,

kikuchan

--001a114e5992f93c6d0517ccc075
Content-Type: text/x-patch; charset=US-ASCII; name="jailed-sysvipc-for-stable10.patch"
Content-Disposition: attachment; 
	filename="jailed-sysvipc-for-stable10.patch"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_iak6apcf0

ZGlmZiAtLWdpdCBhL3N5cy9rZXJuL2tlcm5famFpbC5jIGIvc3lzL2tlcm4va2Vybl9qYWlsLmMK
aW5kZXggZTljNzFjYS4uY2Y2MzE5NiAxMDA2NDQKLS0tIGEvc3lzL2tlcm4va2Vybl9qYWlsLmMK
KysrIGIvc3lzL2tlcm4va2Vybl9qYWlsLmMKQEAgLTYwLDYgKzYwLDcgQEAgX19GQlNESUQoIiRG
cmVlQlNEJCIpOwogI2luY2x1ZGUgPHN5cy9zeXNjYWxsc3Vici5oPgogI2luY2x1ZGUgPHN5cy9z
eXNjdGwuaD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Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG40kxFFnfvbLbqVprPC0oZ%2BnbKDYGxdvgd-vxWXFfN%2B3NQ0_A>