]> bbs.cooldavid.org Git - net-next-2.6.git/commit
don't raise all privs on setuid-root file with fE set (v2)
authorSerge E. Hallyn <serue@us.ibm.com>
Thu, 2 Apr 2009 23:47:14 +0000 (18:47 -0500)
committerJames Morris <jmorris@namei.org>
Fri, 3 Apr 2009 00:49:31 +0000 (11:49 +1100)
commitb5f22a59c0356655a501190959db9f7f5dd07e3f
tree3c20437a6a3b7b7e980078bfbcd0d53cdeda7528
parent3d43321b7015387cfebbe26436d0e9d299162ea1
don't raise all privs on setuid-root file with fE set (v2)

Distributions face a backward compatibility problem with starting to use
file capabilities.  For instance, removing setuid root from ping and
doing setcap cap_net_raw=pe means that booting with an older kernel
or one compiled without file capabilities means ping won't work for
non-root users.

In order to replace the setuid root bit on a capability-unaware
program, one has to set the effective, or legacy, file capability,
which makes the capability effective immediately.  This patch
uses the legacy bit as a queue to not automatically add full
privilege to a setuid-root program.

So, with this patch, an ordinary setuid-root program will run with
privilege.  But if /bin/ping has both setuid-root and cap_net_raw in
fP and fE, then ping (when run by non-root user) will not run
with only cap_net_raw.

Changelog:
Apr 2 2009: Print a message once when such a binary is loaded,
as per James Morris' suggestion.
Apr 2 2009: Fix the condition to only catch uid!=0 && euid==0.

Signed-off-by: Serge E. Hallyn <serue@us.ibm.com>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: James Morris <jmorris@namei.org>
security/commoncap.c