public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Markku Savela <msa@moth.iki.fi>
To: linux-kernel@vger.kernel.org
Subject: Frustrated with capabilities..
Date: Wed, 27 Aug 2008 12:31:10 +0300	[thread overview]
Message-ID: <87hc96by8x.fsf@burp.tkv.asdf.org> (raw)

I just want to run an exectable with limited capabilities and assumed
the following approach would work fine:

 1) fork process
 2) in child

    2.1 set current capabilities (eip) using cap_set_proc
    2.2 execve the executable.

But it frigging does not work! Just before the execve, the result of
cap_to_text is

    = cap_net_bind_service+eip

but, in the execve executable, the result is suddenly

    = cap_net_bind_service+i

Why does the execve clear the effective and permitted capabities,
against my clear instructions? (I also have the prctl KEEP_CAPS set,
though in this case it should be irrelevant).

- The kernel is from ubuntu distro, 2.6.24.

- the executable *does* *not* have any setuid/setgid bits

- the upcoming file capabities will not be any help, because I will
  need to start the same executable with different capabilities
  depending on context.

If this is not a bug in kernel, it is a misdesign, which makes the
obvious use of cap_set_proc rather useless...

-- 
Markku Savela

             reply	other threads:[~2008-08-27  9:31 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-27  9:31 Markku Savela [this message]
2008-08-28 14:18 ` Frustrated with capabilities Pavel Machek
2008-08-28 14:45   ` Markku Savela
2008-08-28 17:48     ` Theodore Tso
2008-08-28 21:03       ` David P. Quigley
2008-08-29  4:47         ` Casey Schaufler
2008-08-29 14:20           ` David P. Quigley
2008-08-29 10:18       ` Markku Savela
2008-08-29 10:47         ` James Morris
2008-08-29 14:07         ` Theodore Tso
2008-08-29 17:11         ` Serge E. Hallyn
2008-08-29 16:58   ` Serge E. Hallyn

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=87hc96by8x.fsf@burp.tkv.asdf.org \
    --to=msa@moth.iki.fi \
    --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