| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2010 IBM Corporation |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Authors: |
|---|
| 5 | 6 | * Mimi Zohar <zohar@us.ibm.com> |
|---|
| 6 | 7 | * |
|---|
| 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 | | - * |
|---|
| 11 | 8 | * File: evm_secfs.c |
|---|
| 12 | 9 | * - Used to signal when key is on keyring |
|---|
| 13 | 10 | * - Get the key and enable EVM |
|---|
| 14 | 11 | */ |
|---|
| 15 | 12 | |
|---|
| 16 | | -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
|---|
| 17 | | - |
|---|
| 18 | 13 | #include <linux/audit.h> |
|---|
| 19 | 14 | #include <linux/uaccess.h> |
|---|
| 20 | | -#include <linux/module.h> |
|---|
| 15 | +#include <linux/init.h> |
|---|
| 21 | 16 | #include <linux/mutex.h> |
|---|
| 22 | 17 | #include "evm.h" |
|---|
| 23 | 18 | |
|---|
| .. | .. |
|---|
| 193 | 188 | if (count > XATTR_NAME_MAX) |
|---|
| 194 | 189 | return -E2BIG; |
|---|
| 195 | 190 | |
|---|
| 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); |
|---|
| 197 | 193 | if (!ab) |
|---|
| 198 | 194 | return -ENOMEM; |
|---|
| 199 | 195 | |
|---|
| .. | .. |
|---|
| 215 | 211 | if (len && xattr->name[len-1] == '\n') |
|---|
| 216 | 212 | xattr->name[len-1] = '\0'; |
|---|
| 217 | 213 | |
|---|
| 214 | + audit_log_format(ab, "xattr="); |
|---|
| 215 | + audit_log_untrustedstring(ab, xattr->name); |
|---|
| 216 | + |
|---|
| 218 | 217 | if (strcmp(xattr->name, ".") == 0) { |
|---|
| 219 | 218 | evm_xattrs_locked = 1; |
|---|
| 220 | 219 | newattrs.ia_mode = S_IFREG | 0440; |
|---|
| .. | .. |
|---|
| 223 | 222 | inode_lock(inode); |
|---|
| 224 | 223 | err = simple_setattr(evm_xattrs, &newattrs); |
|---|
| 225 | 224 | inode_unlock(inode); |
|---|
| 226 | | - audit_log_format(ab, "locked"); |
|---|
| 227 | 225 | if (!err) |
|---|
| 228 | 226 | err = count; |
|---|
| 229 | 227 | goto out; |
|---|
| 230 | 228 | } |
|---|
| 231 | | - |
|---|
| 232 | | - audit_log_format(ab, "xattr="); |
|---|
| 233 | | - audit_log_untrustedstring(ab, xattr->name); |
|---|
| 234 | 229 | |
|---|
| 235 | 230 | if (strncmp(xattr->name, XATTR_SECURITY_PREFIX, |
|---|
| 236 | 231 | XATTR_SECURITY_PREFIX_LEN) != 0) { |
|---|