All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serue@us.ibm.com>
To: Eric Paris <eparis@redhat.com>
Cc: linux-audit@redhat.com, linux-kernel@vger.kernel.org,
	morgan@kernel.org, viro@ZenIV.linux.org.uk
Subject: Re: [PATCH -v2 3/4] AUDIT: collect info when execve results in caps in pE
Date: Tue, 4 Nov 2008 10:35:40 -0600	[thread overview]
Message-ID: <20081104163540.GA24318@us.ibm.com> (raw)
In-Reply-To: <20081103201753.12059.67262.stgit@paris.rdu.redhat.com>

Quoting Eric Paris (eparis@redhat.com):
> diff --git a/security/commoncap.c b/security/commoncap.c
> index 8bb95ed..534abb5 100644
> --- a/security/commoncap.c
> +++ b/security/commoncap.c
> @@ -8,6 +8,7 @@
>   */
> 
>  #include <linux/capability.h>
> +#include <linux/audit.h>
>  #include <linux/module.h>
>  #include <linux/init.h>
>  #include <linux/kernel.h>
> @@ -373,6 +374,9 @@ int cap_bprm_set_security (struct linux_binprm *bprm)
> 
>  void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe)
>  {
> +	kernel_cap_t pP = current->cap_permitted;
> +	kernel_cap_t pE = current->cap_effective;
> +
>  	if (bprm->e_uid != current->uid || bprm->e_gid != current->gid ||
>  	    !cap_issubset(bprm->cap_post_exec_permitted,
>  			  current->cap_permitted)) {
> @@ -407,6 +411,12 @@ void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe)
>  	}
> 
>  	/* AUD: Audit candidate if current->cap_effective is set */
> +	if (!cap_isclear(current->cap_effective)) {
> +		if (!cap_issubset(current->cap_effective, CAP_FULL_SET) ||

Hi Eric,

can you explain what the cap_issubset() check is for here?

thanks,
-serge

> +		    (bprm->e_uid != 0) || (current->uid != 0) ||
> +		    issecure(SECURE_NOROOT))
> +			audit_log_bprm_fcaps(bprm, &pP, &pE);
> +	}
> 
>  	current->securebits &= ~issecure_mask(SECURE_KEEP_CAPS);
>  }

WARNING: multiple messages have this Message-ID (diff)
From: "Serge E. Hallyn" <serue@us.ibm.com>
To: Eric Paris <eparis@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-audit@redhat.com,
	sgrubb@redhat.com, morgan@kernel.org, viro@ZenIV.linux.org.uk
Subject: Re: [PATCH -v2 3/4] AUDIT: collect info when execve results in caps in pE
Date: Tue, 4 Nov 2008 10:35:40 -0600	[thread overview]
Message-ID: <20081104163540.GA24318@us.ibm.com> (raw)
In-Reply-To: <20081103201753.12059.67262.stgit@paris.rdu.redhat.com>

Quoting Eric Paris (eparis@redhat.com):
> diff --git a/security/commoncap.c b/security/commoncap.c
> index 8bb95ed..534abb5 100644
> --- a/security/commoncap.c
> +++ b/security/commoncap.c
> @@ -8,6 +8,7 @@
>   */
> 
>  #include <linux/capability.h>
> +#include <linux/audit.h>
>  #include <linux/module.h>
>  #include <linux/init.h>
>  #include <linux/kernel.h>
> @@ -373,6 +374,9 @@ int cap_bprm_set_security (struct linux_binprm *bprm)
> 
>  void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe)
>  {
> +	kernel_cap_t pP = current->cap_permitted;
> +	kernel_cap_t pE = current->cap_effective;
> +
>  	if (bprm->e_uid != current->uid || bprm->e_gid != current->gid ||
>  	    !cap_issubset(bprm->cap_post_exec_permitted,
>  			  current->cap_permitted)) {
> @@ -407,6 +411,12 @@ void cap_bprm_apply_creds (struct linux_binprm *bprm, int unsafe)
>  	}
> 
>  	/* AUD: Audit candidate if current->cap_effective is set */
> +	if (!cap_isclear(current->cap_effective)) {
> +		if (!cap_issubset(current->cap_effective, CAP_FULL_SET) ||

Hi Eric,

can you explain what the cap_issubset() check is for here?

thanks,
-serge

> +		    (bprm->e_uid != 0) || (current->uid != 0) ||
> +		    issecure(SECURE_NOROOT))
> +			audit_log_bprm_fcaps(bprm, &pP, &pE);
> +	}
> 
>  	current->securebits &= ~issecure_mask(SECURE_KEEP_CAPS);
>  }

  reply	other threads:[~2008-11-04 16:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-03 20:17 [PATCH -v2 1/4] CAPABILITIES: add cpu endian vfs caps structure Eric Paris
2008-11-03 20:17 ` Eric Paris
2008-11-03 20:17 ` [PATCH -v2 2/4] AUDIT: output permitted and inheritable fcaps in PATH records Eric Paris
2008-11-03 20:17   ` Eric Paris
2008-11-03 20:17 ` [PATCH -v2 3/4] AUDIT: collect info when execve results in caps in pE Eric Paris
2008-11-03 20:17   ` Eric Paris
2008-11-04 16:35   ` Serge E. Hallyn [this message]
2008-11-04 16:35     ` Serge E. Hallyn
2008-11-04 19:07     ` Eric Paris
2008-11-04 19:07       ` Eric Paris
2008-11-04 19:28       ` Serge E. Hallyn
2008-11-06 19:26     ` Eric Paris
2008-11-06 19:26       ` Eric Paris
2008-11-06 19:58       ` Serge E. Hallyn
2008-11-03 20:17 ` [PATCH -v2 4/4] AUDIT: emit new record type showing all capset information Eric Paris
2008-11-03 20:17   ` Eric Paris
2008-11-04 16:55   ` Serge E. Hallyn
2008-11-06 19:03     ` Eric Paris
2008-11-06 19:03       ` Eric Paris
2008-11-04 16:45 ` [PATCH -v2 1/4] CAPABILITIES: add cpu endian vfs caps structure Serge E. Hallyn
2008-11-04 16:45   ` Serge E. Hallyn

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=20081104163540.GA24318@us.ibm.com \
    --to=serue@us.ibm.com \
    --cc=eparis@redhat.com \
    --cc=linux-audit@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=morgan@kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.