Linux-audit Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Serge E. Hallyn" <serge@hallyn.com>
To: Richard Guy Briggs <rgb@redhat.com>
Cc: "Serge E. Hallyn" <serge.hallyn@ubuntu.com>, linux-audit@redhat.com
Subject: Re: [PATCH] audit: unswing cap_* fields in PATH records
Date: Fri, 21 Apr 2017 13:20:33 -0500	[thread overview]
Message-ID: <20170421182033.GA1961@mail.hallyn.com> (raw)
In-Reply-To: <1d2c88b04d3288b0e432c2b2561d1fa17b65f25e.1492707910.git.rgb@redhat.com>

Quoting Richard Guy Briggs (rgb@redhat.com):
> The cap_* fields swing in and out of PATH records.
> If no capabilities are set, the cap_* fields are completely missing and when
> one of the cap_fi or cap_fp values is empty, that field is omitted.
> 
> Original:
> type=PATH msg=audit(04/20/2017 12:17:11.222:193) : item=1 name=/lib64/ld-linux-x86-64.so.2 inode=787694 dev=08:03 mode=file,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:ld_so_t:s0 nametype=NORMAL
> type=PATH msg=audit(04/20/2017 12:17:11.222:193) : item=0 name=/home/sleep inode=1319469 dev=08:03 mode=file,suid,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:bin_t:s0 nametype=NORMAL cap_fp=sys_admin cap_fe=1 cap_fver=2
> 
> Normalize the PATH record by always printing all 4 cap_* fields.
> 
> Fixed:
> type=PATH msg=audit(04/20/2017 13:01:31.679:201) : item=1 name=/lib64/ld-linux-x86-64.so.2 inode=787694 dev=08:03 mode=file,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:ld_so_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0
> type=PATH msg=audit(04/20/2017 13:01:31.679:201) : item=0 name=/home/sleep inode=1319469 dev=08:03 mode=file,suid,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:bin_t:s0 nametype=NORMAL cap_fp=sys_admin cap_fi=none cap_fe=1 cap_fver=2
> 
> See: https://github.com/linux-audit/audit-kernel/issues/42
> 
> Signed-off-by: Richard Guy Briggs <rgb@redhat.com>

Is this a big problem for the audit daemon?  There's no actual incorrectness
here right?  I'm not completely opposed, but it does seem like a waste of
space in the (overwhelmingly) most common cases.

> ---
>  kernel/audit.c |   20 ++++----------------
>  1 files changed, 4 insertions(+), 16 deletions(-)
> 
> diff --git a/kernel/audit.c b/kernel/audit.c
> index 10bc2ba..de264d1 100644
> --- a/kernel/audit.c
> +++ b/kernel/audit.c
> @@ -1956,22 +1956,10 @@ void audit_log_cap(struct audit_buffer *ab, char *prefix, kernel_cap_t *cap)
>  
>  static void audit_log_fcaps(struct audit_buffer *ab, struct audit_names *name)
>  {
> -	kernel_cap_t *perm = &name->fcap.permitted;
> -	kernel_cap_t *inh = &name->fcap.inheritable;
> -	int log = 0;
> -
> -	if (!cap_isclear(*perm)) {
> -		audit_log_cap(ab, "cap_fp", perm);
> -		log = 1;
> -	}
> -	if (!cap_isclear(*inh)) {
> -		audit_log_cap(ab, "cap_fi", inh);
> -		log = 1;
> -	}
> -
> -	if (log)
> -		audit_log_format(ab, " cap_fe=%d cap_fver=%x",
> -				 name->fcap.fE, name->fcap_ver);
> +	audit_log_cap(ab, "cap_fp", &name->fcap.permitted);
> +	audit_log_cap(ab, "cap_fi", &name->fcap.inheritable);
> +	audit_log_format(ab, " cap_fe=%d cap_fver=%x",
> +			 name->fcap.fE, name->fcap_ver);
>  }
>  
>  static inline int audit_copy_fcaps(struct audit_names *name,
> -- 
> 1.7.1

  reply	other threads:[~2017-04-21 18:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-20 17:07 [PATCH] audit: unswing cap_* fields in PATH records Richard Guy Briggs
2017-04-21 18:20 ` Serge E. Hallyn [this message]
2017-04-23  5:42   ` Richard Guy Briggs
2017-04-26 19:56 ` Paul Moore
2017-05-23 20:52   ` Paul Moore

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=20170421182033.GA1961@mail.hallyn.com \
    --to=serge@hallyn.com \
    --cc=linux-audit@redhat.com \
    --cc=rgb@redhat.com \
    --cc=serge.hallyn@ubuntu.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox