public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: Jochen Roemling <jochen@roemling.net>
Cc: linux-kernel@vger.kernel.org, Chris Wright <chrisw@osdl.org>
Subject: Re: shmget with SHM_HUGETLB flag: Operation not permitted
Date: Sun, 29 Feb 2004 14:31:53 -0800	[thread overview]
Message-ID: <20040229223153.GJ655@holomorphy.com> (raw)
In-Reply-To: <40425BA2.6030905@roemling.net>

William Lee Irwin III wrote:
>> It's capable(CAP_IPC_LOCK) || in_group_p(0), not current->uid == 0.
>> It will barf if you ask for more than either one of those limits. It
>> will also barf if you ask for an amount not a multiple of the hugepage
>> size. Please show the test program's code and strace the test program
>> to determine what response it's getting.

On Sun, Feb 29, 2004 at 10:37:38PM +0100, Jochen Roemling wrote:
> What do I have to do to make this pgm run as an ordinary user with a 
> stock kernel?

Locked memory is a privileged resource, so you do have to do something
to authenticate lest any user be able to consume all memory on your
system with no possibility of paging it. Examples of what to do to
acquire locked memory specifically for hugetlb shm segments in mainline:

(a) give the user gid 0 as a primary or supplementary group
(b) grant the capability -- yes, it can be done (and is being done in
	practice elsewhere), something is going wrong on your end I
	haven't been able to diagnose.
(c) make requests from a shmget() proxy daemon where you make requests
	over a socket and it hands back shm segment ID's that have had
	their uid's/perms set to the end user. Once shmget() is done,
	shmat() uses normal shm permissions checks.
(d) use a setuid root shmget() helper app.
(e) launch as root, then retain capabilities
(f) launch as root and shmget before dropping privs

(e) and (f) are probably not options in your case. I can't predict
what's going to be desirable on your end in general. You will have to
jump through a hoop of some kind, though, and be glad you do, since
otherwise unbounded amounts of locked memory requested by arbitrary
users could cripple the system's performance or worse.


-- wli

  reply	other threads:[~2004-02-29 22:32 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1tCuq-3AH-1@gated-at.bofh.it>
     [not found] ` <1tCEo-3Lh-27@gated-at.bofh.it>
     [not found]   ` <1tDgT-4r2-13@gated-at.bofh.it>
2004-02-27  0:02     ` shmget with SHM_HUGETLB flag: Operation not permitted Jochen Roemling
     [not found]     ` <403E87CF.1080409@roemling.net>
2004-02-27  0:06       ` Chris Wright
2004-02-27  0:32         ` Chris Wright
2004-02-27  0:55           ` Jochen Roemling
2004-02-27  1:11             ` William Lee Irwin III
2004-02-27  1:33               ` Jochen Roemling
2004-02-27  2:11                 ` William Lee Irwin III
2004-02-29 21:37                   ` Jochen Roemling
2004-02-29 22:31                     ` William Lee Irwin III [this message]
2004-02-27 16:32                 ` Zlatko Calusic
2004-02-27 16:35                   ` William Lee Irwin III
2004-02-27 16:42                     ` Zlatko Calusic
2004-02-27  0:42         ` Wim Coekaerts
     [not found] <1tDJX-4Ua-25@gated-at.bofh.it>
     [not found] ` <1tDJX-4Ua-27@gated-at.bofh.it>
     [not found]   ` <1tDJX-4Ua-29@gated-at.bofh.it>
     [not found]     ` <1tDTE-51P-23@gated-at.bofh.it>
     [not found]       ` <1tDTE-51P-21@gated-at.bofh.it>
2004-02-27  0:35         ` Jochen Roemling
2004-02-27  0:58           ` William Lee Irwin III
2004-02-26 22:36 Jochen Roemling
2004-02-26 22:52 ` William Lee Irwin III
2004-02-26 23:27   ` Chris Wright

Reply instructions:

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

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

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040229223153.GJ655@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=chrisw@osdl.org \
    --cc=jochen@roemling.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox