mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.ibm.com>
To: Frederick Lawler <fred@cloudflare.com>,
	Roberto Sassu	 <roberto.sassu@huawei.com>,
	Dmitry Kasatkin <dmitry.kasatkin@gmail.com>,
	Eric Snowberg <eric.snowberg@oracle.com>,
	Paul Moore <paul@paul-moore.com>,
	James Morris <jmorris@namei.org>,
	"Serge E. Hallyn"	 <serge@hallyn.com>
Cc: linux-integrity@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel-team@cloudflare.com
Subject: Re: [PATCH v2 1/3] integrity: Replace all uses of integrity_audit_msg() with integrity_audit_message()
Date: Tue, 15 Sep 2026 16:00:34 -0400	[thread overview]
Message-ID: <1214eed319ccb441ba0cd26ce168a0383a3e41c6.camel@linux.ibm.com> (raw)
In-Reply-To: <20260727-report-hash-error-v2-1-30e394f524fc@cloudflare.com>

On Mon, 2026-07-27 at 17:21 -0500, Frederick Lawler wrote:
> integrity_audit_msg() wraps integrity_audit_message() such that
> error codes are hidden by passing an additional parameter to
> integrity_audit_message(). Since this is a wrapper, we can replace
> this function with integrity_audit_message() introduced in commit
> 2f845882ecd2 ("integrity: Add errno field in audit message")
> 
> No functional change intended.

There's an unintentional change in ima_write_policy(), which replaces the
existing '1' with result.

> 
> Signed-off-by: Frederick Lawler <fred@cloudflare.com>

Is renaming integrity_audit_msg() to integrity_audit_message() actually the
right approach here?  integrity_audit_message() currently has only 2 callers vs.
~20+ for integrity_audit_msg(), and the rename forces re-wrapping of every
multi-line call site since integrity_audit_message is 4 chars longer, bloating
the first patch.

Why not simply add errno to the integrity_audit_msg() definition and callers.  

Patch 1 — Add errno param to integrity_audit_msg(); update its ~20+ existing
call sites with real error values. Purely semantic, needs careful per-site
review.

Patch 2 — Convert integrity_audit_message()'s 2 callers to integrity_audit_msg()
(now identical signature, trivial rename), then delete integrity_audit_message()
as dead code. Purely mechanical, trivially reviewable, no functional risk.

thanks,

Mimi

> ---
> 
>  
> diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c
> index 2a0bca5543161912abe2a0236c9fcae7055e62bc..a0c1a6dd6a750220b529cc3f77c2ae5673188e11 100644
> --- a/security/integrity/ima/ima_fs.c
> +++ b/security/integrity/ima/ima_fs.c
> @@ -593,9 +593,10 @@ static ssize_t ima_write_policy(struct file *file, const char __user *buf,
>  		result = ima_read_policy(data);
>  	} else if (ima_appraise & IMA_APPRAISE_POLICY) {
>  		pr_err("signed policy file (specified as an absolute pathname) required\n");
> -		integrity_audit_msg(AUDIT_INTEGRITY_STATUS, NULL, NULL,
> -				    "policy_update", "signed policy required",
> -				    1, 0);
> +		integrity_audit_message(AUDIT_INTEGRITY_STATUS, NULL, NULL,
> +					"policy_update",
> +					"signed policy required",
> +					result, 0, 0);
>  		result = -EACCES;
>  	} else {
>  		ima_measure_raw_policy(data, datalen);

  reply	other threads:[~2026-09-15 20:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-27 22:21 [PATCH v2 0/3] integrity: Return error codes in audit messages Frederick Lawler
2026-07-27 22:21 ` [PATCH v2 1/3] integrity: Replace all uses of integrity_audit_msg() with integrity_audit_message() Frederick Lawler
2026-09-15 20:00   ` Mimi Zohar [this message]
2026-09-15 21:08     ` Frederick Lawler
2026-09-15 21:32       ` Mimi Zohar
2026-07-27 22:21 ` [PATCH v2 2/3] integrity: Remove integrity_audit_msg() Frederick Lawler
2026-07-27 22:21 ` [PATCH v2 3/3] integrity: Report error code in integrity_audit_message() call sites Frederick Lawler
2026-09-09 17:53 ` [PATCH v2 0/3] integrity: Return error codes in audit messages Frederick Lawler
2026-09-10  1:23   ` 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=1214eed319ccb441ba0cd26ce168a0383a3e41c6.camel@linux.ibm.com \
    --to=zohar@linux.ibm.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=eric.snowberg@oracle.com \
    --cc=fred@cloudflare.com \
    --cc=jmorris@namei.org \
    --cc=kernel-team@cloudflare.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=roberto.sassu@huawei.com \
    --cc=serge@hallyn.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

all inboxes | Powered by JetHome®