mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michael Tokarev <mjt@tls.msk.ru>
To: linux-kernel@vger.kernel.org
Subject: Wondering: why capabilities system is broken?
Date: Tue, 17 Apr 2007 23:48:01 +0400	[thread overview]
Message-ID: <46252471.2030006@tls.msk.ru> (raw)

Hopefully not a flamewar question...

Currently, capabilities of a process are reset during exec()
system call.  At least effective+permitted set.

1) In case new uid != 0, all the caps are cleared, so it is not
possible to execute a program as non-root but still give it some
capabilities (like, say, CAP_NET_BIND_SERVICE).

2) In case new uid == 0, effective and permitted sets are restored
to all-ones.

This is regardless of other settings, like prctl(KEEPCAPS), or
the current set of capabilities.

I partly understand why 2) is done - in case of setuid binary being
executed, all the capabilities are set for it.  But this breaks
executing non-setuid binaries too -- for example, it'd be very nice
to be able to chroot to some directory, and remove CAP_SYS_CHROOT
(and other evil caps like CAP_SYS_MODULE, CAP_SETPCAP) -- this way,
with minimal efforts, chroot will work almost (yes, I understand
it's not entirely the same) the same as BSD jail(2) concept.

So the question is: why capability sets are being reinitialized during
exec()?  At least in 2.4 era, they weren't...  and stuff like
execcap, sucaps etc was working.  Now they aren't anymore.

Thanks.

/mjt

             reply	other threads:[~2007-04-17 19:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-17 19:48 Michael Tokarev [this message]
2007-04-18  1:57 ` 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=46252471.2030006@tls.msk.ru \
    --to=mjt@tls.msk.ru \
    --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

all inboxes | Powered by JetHome®