mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue@us.ibm.com>
To: Serge Aleynikov <serge@hq.idt.net>
Cc: "Serge E. Hallyn" <serue@us.ibm.com>,
	linux-kernel@vger.kernel.org, Linus Torvalds <torvalds@osdl.org>,
	Alan Cox <alan@redhat.com>
Subject: Re: non-critical security bug fix
Date: Thu, 12 Oct 2006 15:29:26 -0500	[thread overview]
Message-ID: <20061012202926.GA5690@sergelap.austin.ibm.com> (raw)
In-Reply-To: <452E96C5.8070307@hq.idt.net>

Quoting Serge Aleynikov (serge@hq.idt.net):
> Serge (what a nice name!  ;-) ),
> 
> Let me give you an example where we found this patch very useful.
> 
> A 3rd party library that we bought implemented a user-level SCTP 
> protocol by opening raw sockets.  This required our application to run 
> as root.  However, we didn't want for it to run as root, and wanted to 
> set the CAP_NET_RAW option and have the interaction with the raw socket 
> survive after when we switch the effective user away from root.
> 
> When reading "man capabilities" we found:
> 
> "If  a  process  that has a 0 value for one or more of its user IDs 
> wants to prevent its permitted capability set being cleared when it 

Right, *permitted*.

> resets all of its user IDs to non-zero values, it can  do  so  using 
> the  prctl() PR_SET_KEEPCAPS operation."
> 
> Correct me if I am wrong, but I believe that this sentence says just 
> what I described above.

No, you're asking for the effective set to also not be cleared, but the
manpage only says the permitted set is maintained.

> If so, the previously attached patch has the 
> behavior described in the man page.

Are you able to modify the source of the application you bought?  If so,
you can trivially fix it to do what you need by doing a cap_set_proc
after the suid as I described before, i.e.

	ret = setuid();
	caps = cap_from_text("cap_net_raw=e");
	ret = cap_set_proc(caps);

Is that an option?

-serge

  reply	other threads:[~2006-10-12 20:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-11 18:58 Serge Aleynikov
2006-10-12 19:06 ` Serge E. Hallyn
2006-10-12 19:25   ` Serge Aleynikov
2006-10-12 20:29     ` Serge E. Hallyn [this message]
2006-10-12 21:11       ` Serge Aleynikov

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=20061012202926.GA5690@sergelap.austin.ibm.com \
    --to=serue@us.ibm.com \
    --cc=alan@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=serge@hq.idt.net \
    --cc=torvalds@osdl.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®