[apparmor] [PATCH 16/16] apparmor: clear the full task context when setting onexec.

Seth Arnold seth.arnold at canonical.com
Thu Apr 28 04:14:07 UTC 2016


On Wed, Apr 20, 2016 at 11:52:58PM -0700, John Johansen wrote:
> This prevents a bug where a hat could be used to set onexec and then
> return to parent with it set.
> 
> If in a hat when onexec is set then return to parent will be prevented.

This looks like a potentially surprising change. If an exec() fails, a
program may reasonably try to aa_changehat() back to the parent afterward,
and continue, no? This change will kill the process if it tries.

> Signed-off-by: John Johansen <john.johansen at canonical.com>

The code change itself looks good, so:

Acked-by: Seth Arnold <seth.arnold at canonical.com>

Thanks

> ---
>  security/apparmor/context.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/security/apparmor/context.c b/security/apparmor/context.c
> index 3064c6c..a3d836e 100644
> --- a/security/apparmor/context.c
> +++ b/security/apparmor/context.c
> @@ -138,7 +138,7 @@ int aa_set_current_onexec(struct aa_profile *profile)
>  
>  	cxt = cred_cxt(new);
>  	aa_get_profile(profile);
> -	aa_put_profile(cxt->onexec);
> +	aa_clear_task_cxt_trans(cxt);
>  	cxt->onexec = profile;
>  
>  	commit_creds(new);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20160427/71df7762/attachment.pgp>


More information about the AppArmor mailing list