Skip to content

Commit

Permalink
capabilities: do not special case exec of init
Browse files Browse the repository at this point in the history
When the global init task is exec'd we have special case logic to make sure
the pE is not reduced.  There is no reason for this.  If init wants to drop
it's pE is should be allowed to do so.  Remove this special logic.

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Serge Hallyn <serge@hallyn.com>
Acked-by: David Howells <dhowells@redhat.com>
Acked-by: Andrew G. Morgan <morgan@kernel.org>
Signed-off-by: James Morris <jmorris@namei.org>
  • Loading branch information
eparis authored and James Morris committed Apr 4, 2011
1 parent 17f60a7 commit 4bf2ea7
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions security/commoncap.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,15 +529,10 @@ int cap_bprm_set_creds(struct linux_binprm *bprm)
new->suid = new->fsuid = new->euid;
new->sgid = new->fsgid = new->egid;

/* For init, we want to retain the capabilities set in the initial
* task. Thus we skip the usual capability rules
*/
if (!is_global_init(current)) {
if (effective)
new->cap_effective = new->cap_permitted;
else
cap_clear(new->cap_effective);
}
if (effective)
new->cap_effective = new->cap_permitted;
else
cap_clear(new->cap_effective);
bprm->cap_effective = effective;

/*
Expand Down

0 comments on commit 4bf2ea7

Please sign in to comment.