mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Olaf Dietsche <olaf+list.linux-kernel@olafdietsche.de>
To: Andy Lutomirski <luto@myrealbox.com>
Cc: Chris Wright <chrisw@osdl.org>,
	Stephen Smalley <sds@epoch.ncsc.mil>,
	Albert Cahalan <albert@users.sourceforge.net>,
	linux-kernel mailing list <linux-kernel@vger.kernel.org>,
	Valdis.Kletnieks@vt.edu
Subject: Re: [PATCH] scaled-back caps, take 4
Date: Sun, 23 May 2004 20:48:25 +0200	[thread overview]
Message-ID: <87n03zq8sm.fsf@goat.bogus.local> (raw)
In-Reply-To: <200405230228.28418.luto@myrealbox.com>

Andy Lutomirski <luto@myrealbox.com> writes:

> You don't like my patch because it rips out a bunch of code and it's
> not clear it won't break stuff.
>
> I don't like your patch because it takes a bunch of incomprehensible
> code that does almost nothing and tweaks it slightly to do something
> useful.  (That's not to say it's does the wrong thing; I just don't
> think the code is clear.)
>
> So I decided to figure out what was going on with the original code.
>
> First, CAP_SETPCAP is never obtainable (by anything).
> Since cap_bset never has this bit set, nothing can inherit it
> from fP.  capset_check prevents it from getting set in pI.

# mv /sbin/init /sbin/init.bin
# cat >/sbin/init
#! /bin/sh

if test $$ -eq 1; then
        mount /proc
        echo -1 >/proc/sys/kernel/cap-bound
fi

exec /sbin/init.bin "$@"
^D
# chmod 755 /sbin/init
# reboot

> Second, cap_bset is broken.  For one thing, there's no way
> to remove the caps you want to restrict from already-running
> tasks.  So I don't think it matters if we break/change it.

Maybe I don't understand this, but I think this is what sys_capset()
is for.

> cap_bprm_set_security does:
> fP = fI = (new_uid == 0 || new_euid == 0)
> fE = (new_euid == 0)

Only if (!issecure (SECURE_NOROOT))

[...]
> The whole result is just
> pP' = (uid == 0 || euid==0) & X
> pE' = (euid == 0) & X
>
> This patch implements this.  It should be invisible to userspace
> (unless userspace (ab)uses cap_bset).  It also adds a secureexec
> flag, which we both need.
>
> First, did I get this right?  It seems to work :)

With this patch you effectively revert all capable() calls back to
suser() tests. If this is what you intended, your patch looks fine.

> Second, do you have any objection to both of us redoing our
> patches against this one?  It should make them nicer-looking
> at least.

I didn't scrutinize capabilities as thoroughly as you did, but I still
don't see why your patch is necessary, besides the changes in
fs/exec.c and include/binfmts.h, maybe.

$ cp commoncap.c lutocap.c
modify it to your liking
# insmod lutocap

same goes for chriscap.c

Please, don't get me wrong. For me, it's just a matter of maintaining
a slightly bigger fscaps patch. But I don't think capabilities in
Linux are really broken, only because some proponents of SELinux claim
so.

If you want a simpler - setuid like - capabilities model, throw out
the inheritable _and_ permitted set and use the effective set alone.

Regards, Olaf.

  reply	other threads:[~2004-05-23 18:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <fa.dt4cg55.jnqvr5@ifi.uio.no>
     [not found] ` <fa.mu5rj3d.24gtbp@ifi.uio.no>
2004-05-14 15:57   ` [PATCH] capabilites, take 2 Andy Lutomirski
2004-05-14 16:01     ` Stephen Smalley
2004-05-14 16:18       ` Andy Lutomirski
2004-05-14 16:37         ` Stephen Smalley
2004-05-14 18:07         ` Chris Wright
2004-05-14 22:48           ` [PATCH] scaled-back caps, take 4 (was Re: [PATCH] capabilites, take 2) Andy Lutomirski
2004-05-15  0:06             ` [PATCH] scaled-back caps, take 4 Olaf Dietsche
2004-05-14 22:09               ` Albert Cahalan
2004-05-15  0:27               ` Chris Wright
     [not found]             ` <20040517231912.H21045@build.pdx.osdl.net>
2004-05-18  9:11               ` [PATCH] scaled-back caps, take 4 (was Re: [PATCH] capabilites, take 2) Andy Lutomirski
2004-05-19  1:27                 ` Chris Wright
2004-05-19  1:54                   ` [PATCH] scaled-back caps, take 4 Andy Lutomirski
2004-05-19  7:30                     ` Chris Wright
2004-05-23  9:28                       ` Andy Lutomirski
2004-05-23 18:48                         ` Olaf Dietsche [this message]
2004-05-24 23:38                       ` [PATCH] caps, compromise version (was Re: [PATCH] scaled-back caps, take 4) Andy Lutomirski
2004-05-24 23:56                         ` Chris Wright
2004-05-25  0:23                           ` Andy Lutomirski
     [not found]               ` <20040517235844.I21045@build.pdx.osdl.net>
2004-05-19  1:34                 ` [PATCH] support cap inheritable (Re: [PATCH] scaled-back caps, take 4 (was Re: [PATCH] capabilites, take 2) Andy Lutomirski
2004-05-19  7:27                   ` Chris Wright
     [not found] <fa.id6it11.41id3h@ifi.uio.no>
     [not found] ` <fa.gf5v6pu.c2mkrq@ifi.uio.no>
2004-05-17  7:19   ` [PATCH] scaled-back caps, take 4 Andy Lutomirski
2004-05-17 11:59     ` Stephen Smalley
     [not found] <fa.i8g63r1.9jata3@ifi.uio.no>
     [not found] ` <fa.hjocttu.1cgcc3q@ifi.uio.no>
     [not found]   ` <40B0F65F.3020706@myrealbox.com>
2004-05-23 20:57     ` Olaf Dietsche
2004-05-24 16:55       ` Martin Schlemmer

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=87n03zq8sm.fsf@goat.bogus.local \
    --to=olaf+list.linux-kernel@olafdietsche.de \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=albert@users.sourceforge.net \
    --cc=chrisw@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@myrealbox.com \
    --cc=sds@epoch.ncsc.mil \
    /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®