public inbox for linux-audit@redhat.com
 help / color / mirror / Atom feed
From: Eric Paris <eparis@redhat.com>
To: Mimi Zohar <zohar@linux.vnet.ibm.com>
Cc: David Safford <safford@watson.ibm.com>,
	linux-audit@redhat.com, James Morris <jmorris@namei.org>,
	Mimi Zohar <zohar@us.ibm.com>
Subject: Re: [PATCH 2/8] integrity: IMA as an integrity service provider
Date: Fri, 06 Mar 2009 17:07:11 -0500	[thread overview]
Message-ID: <1236377231.3602.8.camel@localhost.localdomain> (raw)
In-Reply-To: <3323eec921efd815178a23107ab63588c605c0b2.1233946566.git.zohar@linux.vnet.ibm.com>

I'm very slow to the game, I know, but today was the first kernel that I
built from linux-next with IMA on.  I have a comment, and hopefully more
to come....

On Fri, 2009-02-06 at 14:52 -0500, Mimi Zohar wrote:
> +void integrity_audit_msg(int audit_msgno, struct inode *inode,
> +                        const unsigned char *fname, const char *op,
> +                        const char *cause, int result, int audit_info)
> +{
> +       struct audit_buffer *ab;
> +
> +       if (!ima_audit && audit_info == 1) /* Skip informational messages */
> +               return;
> +
> +       ab = audit_log_start(current->audit_context, GFP_KERNEL, audit_msgno);
> +       audit_log_format(ab, "integrity: pid=%d uid=%u auid=%u",
> +                        current->pid, current->cred->uid,
> +                        audit_get_loginuid(current));
> +       audit_log_task_context(ab);
> +       switch (audit_msgno) {
> +       case AUDIT_INTEGRITY_DATA:
> +       case AUDIT_INTEGRITY_METADATA:
> +       case AUDIT_INTEGRITY_PCR:
> +               audit_log_format(ab, " op=%s cause=%s", op, cause);

There are cases where (at least) cause can be a multiword string.  These
should be using audit_log_string() instead of %s.  I'm starting to frown
on %s in audit log more and more heavily these days, actually I don't
think I should let any more users of %s in at all.  If you want I'll go
through and change all of these, but I want to make sure that you will
be ok with multiword string being either "" or translated.  An example
of the problem I see would be in say ima_update_policy() where you have
const char *cause = "already exists";  Currently that record will get
emitted like:

blah cause=already exists blah

which screws up parsers.  It should be:

blah cause="already exists" blah

make sense?

> +               break;
> +       case AUDIT_INTEGRITY_HASH:
> +               audit_log_format(ab, " op=%s hash=%s", op, cause);
> +               break;
> +       case AUDIT_INTEGRITY_STATUS:
> +       default:
> +               audit_log_format(ab, " op=%s", op);
> +       }
> +       audit_log_format(ab, " comm=");
> +       audit_log_untrustedstring(ab, current->comm);
> +       if (fname) {
> +               audit_log_format(ab, " name=");
> +               audit_log_untrustedstring(ab, fname);
> +       }
> +       if (inode)
> +               audit_log_format(ab, " dev=%s ino=%lu",
> +                                inode->i_sb->s_id, inode->i_ino);
> +       audit_log_format(ab, " res=%d", result);
> +       audit_log_end(ab);

  parent reply	other threads:[~2009-03-06 22:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-06 19:52 [PATCH 0/8] integrity Mimi Zohar
2009-02-06 19:52 ` [PATCH 1/8] integrity: IMA hooks Mimi Zohar
2009-02-06 19:52 ` [PATCH 2/8] integrity: IMA as an integrity service provider Mimi Zohar
2009-02-06 22:04   ` Steve Grubb
2009-02-09  2:42     ` Mimi Zohar
2009-02-09 14:51       ` Steve Grubb
2009-02-09 23:20         ` Mimi Zohar
2009-03-06 22:07   ` Eric Paris [this message]
2009-03-09 11:07     ` Mimi Zohar
2009-02-06 19:52 ` [PATCH 3/8] integrity: IMA display Mimi Zohar
2009-02-06 19:52 ` [PATCH 4/8] integrity: IMA policy Mimi Zohar
2009-02-06 19:52 ` [PATCH 5/8] integrity: IMA policy open Mimi Zohar
2009-02-06 19:52 ` [PATCH 6/8] Integrity: IMA file free imbalance Mimi Zohar
2009-02-06 19:52 ` [PATCH 7/8] Integrity: IMA update maintainers Mimi Zohar
2009-02-06 19:52 ` [PATCH 8/8] IMA: fix ima_delete_rules() definition Mimi Zohar

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=1236377231.3602.8.camel@localhost.localdomain \
    --to=eparis@redhat.com \
    --cc=jmorris@namei.org \
    --cc=linux-audit@redhat.com \
    --cc=safford@watson.ibm.com \
    --cc=zohar@linux.vnet.ibm.com \
    --cc=zohar@us.ibm.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