hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/security/integrity/integrity_audit.c
....@@ -1,10 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2008 IBM Corporation
34 * Author: Mimi Zohar <zohar@us.ibm.com>
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation, version 2 of the License.
85 *
96 * File: integrity_audit.c
107 * Audit calls for the integrity subsystem
....@@ -32,6 +29,15 @@
3229 const unsigned char *fname, const char *op,
3330 const char *cause, int result, int audit_info)
3431 {
32
+ integrity_audit_message(audit_msgno, inode, fname, op, cause,
33
+ result, audit_info, 0);
34
+}
35
+
36
+void integrity_audit_message(int audit_msgno, struct inode *inode,
37
+ const unsigned char *fname, const char *op,
38
+ const char *cause, int result, int audit_info,
39
+ int errno)
40
+{
3541 struct audit_buffer *ab;
3642 char name[TASK_COMM_LEN];
3743
....@@ -43,7 +49,7 @@
4349 return;
4450 audit_log_format(ab, "pid=%d uid=%u auid=%u ses=%u",
4551 task_pid_nr(current),
46
- from_kuid(&init_user_ns, current_cred()->uid),
52
+ from_kuid(&init_user_ns, current_uid()),
4753 from_kuid(&init_user_ns, audit_get_loginuid(current)),
4854 audit_get_sessionid(current));
4955 audit_log_task_context(ab);
....@@ -58,6 +64,6 @@
5864 audit_log_untrustedstring(ab, inode->i_sb->s_id);
5965 audit_log_format(ab, " ino=%lu", inode->i_ino);
6066 }
61
- audit_log_format(ab, " res=%d", !result);
67
+ audit_log_format(ab, " res=%d errno=%d", !result, errno);
6268 audit_log_end(ab);
6369 }