Skip to content

Commit

Permalink
apparmor: Fix change_onexec when called from a confined task
Browse files Browse the repository at this point in the history
Fix failure in aa_change_onexec api when the request is made from a confined
task.  This failure was caused by two problems

 The AA_MAY_ONEXEC perm was not being mapped correctly for this case.

 The executable name was being checked as second time instead of using the
 requested onexec profile name, which may not be the same as the exec
 profile name. This mistake can not be exploited to grant extra permission
 because of the above flaw where the ONEXEC permission was not being mapped
 so it will not be granted.

BugLink: http://bugs.launchpad.net/bugs/963756

Signed-off-by: John Johansen <[email protected]>
Signed-off-by: James Morris <[email protected]>
  • Loading branch information
John Johansen authored and James Morris committed Mar 27, 2012
1 parent e22057c commit 0421ea9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion security/apparmor/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,8 @@ int apparmor_bprm_set_creds(struct linux_binprm *bprm)
* exec\0change_profile
*/
state = aa_dfa_null_transition(profile->file.dfa, state);
cp = change_profile_perms(profile, cxt->onexec->ns, name,
cp = change_profile_perms(profile, cxt->onexec->ns,
cxt->onexec->base.name,
AA_MAY_ONEXEC, state);

if (!(cp.allow & AA_MAY_ONEXEC))
Expand Down
2 changes: 2 additions & 0 deletions security/apparmor/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ static struct file_perms compute_perms(struct aa_dfa *dfa, unsigned int state,
/* change_profile wasn't determined by ownership in old mapping */
if (ACCEPT_TABLE(dfa)[state] & 0x80000000)
perms.allow |= AA_MAY_CHANGE_PROFILE;
if (ACCEPT_TABLE(dfa)[state] & 0x40000000)
perms.allow |= AA_MAY_ONEXEC;

return perms;
}
Expand Down

0 comments on commit 0421ea9

Please sign in to comment.