From: Steve Grubb <sgrubb@redhat.com>
To: Richard Guy Briggs <rgb@redhat.com>
Cc: Linux-Audit Mailing List <linux-audit@redhat.com>
Subject: Re: [PATCH] audit: shorten PATH cap values when zero
Date: Sun, 18 Nov 2018 23:59:40 -0500 [thread overview]
Message-ID: <1923970.PWLkRajZAz@x2> (raw)
In-Reply-To: <c61ff3255e7714c1a9b34bde6ad732f9bd1f1fff.1542387912.git.rgb@redhat.com>
On Friday, November 16, 2018 12:10:01 PM EST Richard Guy Briggs wrote:
> Since the vast majority of files (99.993% on a typical system) have no
> fcaps, display "0" instead of the full zero-padded 16 hex digits in the
> two PATH record cap_f* fields to save netlink bandwidth and disk space.
>
> Simply changing the format to %x won't work since the value is two (or
> possibly more in the future) 32-bit hexadecimal values concatenated and
> bits in higher order values will be misrepresented.
>
> Passes audit-testsuite and userspace tools already work fine.
> Please see the github issue tracker for more details
> https://github.com/linux-audit/audit-kernel/issues/101
>
> Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
Ack.
Thanks for doing this. It helps to alleviate my concern about wasted disk
space for normal files.
-Steve
> ---
> kernel/audit.c | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/kernel/audit.c b/kernel/audit.c
> index 2a8058764aa6..90cbc89fd6d2 100644
> --- a/kernel/audit.c
> +++ b/kernel/audit.c
> @@ -2057,11 +2057,16 @@ void audit_log_key(struct audit_buffer *ab, char
> *key) void audit_log_cap(struct audit_buffer *ab, char *prefix,
> kernel_cap_t *cap) {
> int i;
> -
> - audit_log_format(ab, " %s=", prefix);
> - CAP_FOR_EACH_U32(i) {
> - audit_log_format(ab, "%08x",
> - cap->cap[CAP_LAST_U32 - i]);
> + u32 nonzero = 0;
> +
> + CAP_FOR_EACH_U32(i)
> + nonzero |= cap->cap[CAP_LAST_U32 - i];
> + if (nonzero) {
> + audit_log_format(ab, " %s=", prefix);
> + CAP_FOR_EACH_U32(i)
> + audit_log_format(ab, "%08x", cap->cap[CAP_LAST_U32 - i]);
> + } else {
> + audit_log_format(ab, " %s=0", prefix);
> }
> }
next prev parent reply other threads:[~2018-11-19 4:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-16 17:10 [PATCH] audit: shorten PATH cap values when zero Richard Guy Briggs
2018-11-19 4:59 ` Steve Grubb [this message]
2018-11-19 21:22 ` Paul Moore
2018-11-19 21:51 ` Richard Guy Briggs
2018-11-19 22:05 ` 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=1923970.PWLkRajZAz@x2 \
--to=sgrubb@redhat.com \
--cc=linux-audit@redhat.com \
--cc=rgb@redhat.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