From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: Stephen Smalley <sds@tycho.nsa.gov>
Cc: Oleg Nesterov <oleg@redhat.com>, James Morris <jmorris@namei.org>,
David Howells <dhowells@redhat.com>,
Eric Paris <eparis@parisplace.org>,
Roland McGrath <roland@redhat.com>,
linux-kernel@vger.kernel.org
Subject: Re: Q: selinux_bprm_committed_creds() && signals/do_wait
Date: Wed, 29 Apr 2009 15:47:01 +0100 [thread overview]
Message-ID: <20090429154701.2e5b15f6@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <1241011014.18249.192.camel@localhost.localdomain>
> > For example, a user does "nohup setuid_app". Now, why should we change
> > SIG_IGN to SIG_DFL for SIGHUP? This makes setuid_app more "vulnerable"
> > to SIGHUP, not more "protected". Confused.
>
> Not if the app was depending on the default handler for SIGHUP to
> correctly handle vhangup(). The point is that we don't necessarily
> trust the caller to define the handling behavior for signals in the
> callee. If we trust the caller to do so, then we can grant the
> corresponding permission.
You are changing standards defined behaviour - so apps that rely on
correct behaviour maybe misbehave or become vulnerable in ways not
anticipated
A classic example here is SIGPIPE. What you are doing by dropping to
default signal behaviour is breaking various inetd style setups that know
the child will inherit SIGPIPE as SIG_IGN and therefore will cleanly
process network connection loss.
Instead the child will now suffer immediate termination and not
have a chance to clean up.
So mucking with signal masks is actually not improving security - it's
randomly changing things - and randomly changing things to disagree with
the spec is a very very bad idea IMHO as you will harm correctly written
code.
> But we still have the problem of the caller setting up the signal
> handlers or blocked signal mask prior to exec'ing the privileged
> program, right
No.
A signal handler function is cleared across a setuid exec so you can't
set an address and jump to it in the new binary. K&R thought of that
one ;)
A signal mask is inherited and this is *required to be so*. Changing it
breaks stuff and may itself introduce security problems.
Any setuid app has to be reasonably robust because it may get very
strange file handles, very strange signal masks, quotas, resource limits
and other stuff. Signals are just one trivial detail.
Clearing a lot of these is hard as you don't know what the resource
limits etc for the setuid target are and you don't want a pair of setuid
user A and user B apps co-operating to evade things.
The correct way to do most of this is not to use setuid apps run by the
user but to pass authority information to service daemons that run
services within a known non-user influencable environment in the first
place... the very daemons that randomly clearing the SIG_IGN on SIGPIPE
will break !
Alan
next prev parent reply other threads:[~2009-04-29 14:47 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-28 22:30 Oleg Nesterov
2009-04-28 23:33 ` Oleg Nesterov
2009-04-29 16:01 ` [PATCH] do_wait: do take security_task_wait() into account Oleg Nesterov
2009-04-30 20:31 ` Roland McGrath
2009-04-30 22:51 ` James Morris
2009-05-06 11:46 ` Stephen Smalley
2009-04-29 0:29 ` Q: selinux_bprm_committed_creds() && signals/do_wait James Morris
2009-04-29 6:58 ` Oleg Nesterov
2009-04-29 12:20 ` Stephen Smalley
2009-04-29 12:56 ` Oleg Nesterov
2009-04-29 13:16 ` Stephen Smalley
2009-04-29 13:42 ` Oleg Nesterov
2009-04-29 13:43 ` Stephen Smalley
2009-04-29 14:47 ` Alan Cox [this message]
2009-04-29 15:39 ` Stephen Smalley
2009-04-29 10:02 ` David Howells
2009-04-29 10:25 ` Oleg Nesterov
2009-04-29 11:17 ` David Howells
2009-04-29 11:55 ` Oleg Nesterov
2009-04-29 12:42 ` David Howells
2009-04-29 12:45 ` David Howells
2009-04-29 13:28 ` Oleg Nesterov
2009-04-30 0:37 ` James Morris
2009-04-29 13:18 ` Stephen Smalley
2009-04-29 13:30 ` Oleg Nesterov
2009-04-29 14:02 ` ptrace: selinux_bprm_committed_creds: simplify __wake_up_parent() code and s/parent/real_parent/ Oleg Nesterov
2009-04-29 14:08 ` Oleg Nesterov
2009-04-30 22:44 ` Roland McGrath
2009-05-03 20:10 ` Oleg Nesterov
2009-05-04 17:38 ` Roland McGrath
2009-04-30 0:38 ` James Morris
2009-04-30 22:38 ` Roland McGrath
2009-04-29 14:48 ` Q: selinux_bprm_committed_creds() && signals/do_wait Alan Cox
2009-05-01 0:02 ` Roland McGrath
2009-05-03 20:21 ` Oleg Nesterov
2009-05-04 17:34 ` Roland McGrath
2009-05-01 0:44 ` David Howells
2009-05-01 0:50 ` Roland McGrath
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=20090429154701.2e5b15f6@lxorguk.ukuu.org.uk \
--to=alan@lxorguk.ukuu.org.uk \
--cc=dhowells@redhat.com \
--cc=eparis@parisplace.org \
--cc=jmorris@namei.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=roland@redhat.com \
--cc=sds@tycho.nsa.gov \
/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®