hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/security/integrity/evm/evm_secfs.c
....@@ -1,23 +1,18 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2010 IBM Corporation
34 *
45 * Authors:
56 * Mimi Zohar <zohar@us.ibm.com>
67 *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation, version 2 of the License.
10
- *
118 * File: evm_secfs.c
129 * - Used to signal when key is on keyring
1310 * - Get the key and enable EVM
1411 */
1512
16
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
17
-
1813 #include <linux/audit.h>
1914 #include <linux/uaccess.h>
20
-#include <linux/module.h>
15
+#include <linux/init.h>
2116 #include <linux/mutex.h>
2217 #include "evm.h"
2318
....@@ -193,7 +188,8 @@
193188 if (count > XATTR_NAME_MAX)
194189 return -E2BIG;
195190
196
- ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_INTEGRITY_EVM_XATTR);
191
+ ab = audit_log_start(audit_context(), GFP_KERNEL,
192
+ AUDIT_INTEGRITY_EVM_XATTR);
197193 if (!ab)
198194 return -ENOMEM;
199195
....@@ -215,6 +211,9 @@
215211 if (len && xattr->name[len-1] == '\n')
216212 xattr->name[len-1] = '\0';
217213
214
+ audit_log_format(ab, "xattr=");
215
+ audit_log_untrustedstring(ab, xattr->name);
216
+
218217 if (strcmp(xattr->name, ".") == 0) {
219218 evm_xattrs_locked = 1;
220219 newattrs.ia_mode = S_IFREG | 0440;
....@@ -223,14 +222,10 @@
223222 inode_lock(inode);
224223 err = simple_setattr(evm_xattrs, &newattrs);
225224 inode_unlock(inode);
226
- audit_log_format(ab, "locked");
227225 if (!err)
228226 err = count;
229227 goto out;
230228 }
231
-
232
- audit_log_format(ab, "xattr=");
233
- audit_log_untrustedstring(ab, xattr->name);
234229
235230 if (strncmp(xattr->name, XATTR_SECURITY_PREFIX,
236231 XATTR_SECURITY_PREFIX_LEN) != 0) {