Re: [PATCH -v2 3/4] AUDIT: collect info when execve results incaps in pE
From: Eric Paris
Date: Tue Nov 04 2008 - 14:07:54 EST
On Tue, 2008-11-04 at 10:35 -0600, Serge E. Hallyn wrote:
> Quoting Eric Paris (eparis@xxxxxxxxxx):
> > 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?
I'm glad you noticed it, because it is backwards!
should be
if (!cap_issubset(CAP_FULL_SET, current->cap_effective) ||
The idea is that I don't care to audit
1) full set &&
2) this is root &&
3) root should have a full set
This would still consider a root without a full set because the bset had
been changed to be an interesting event. I'm fine with that.
I'll send -v3 once I hear comments on everything else....
-Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/