[PATCH 26/27] lockdown: Print current->comm in restriction messages

From: Matthew Garrett
Date: Mon Mar 25 2019 - 18:11:11 EST


From: David Howells <dhowells@xxxxxxxxxx>

Print the content of current->comm in messages generated by lockdown to
indicate a restriction that was hit. This makes it a bit easier to find
out what caused the message.

The message now patterned something like:

Lockdown: <comm>: <what> is restricted; see man kernel_lockdown.7

Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
Signed-off-by: Matthew Garrett <matthewgarrett@xxxxxxxxxx>
---
security/lock_down.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/security/lock_down.c b/security/lock_down.c
index 18d8776a4d02..ee00ca2677e7 100644
--- a/security/lock_down.c
+++ b/security/lock_down.c
@@ -53,8 +53,8 @@ void __init init_lockdown(void)
bool __kernel_is_locked_down(const char *what, bool first)
{
if (what && first && kernel_locked_down)
- pr_notice("Lockdown: %s is restricted; see man kernel_lockdown.7\n",
- what);
+ pr_notice("Lockdown: %s: %s is restricted; see man kernel_lockdown.7\n",
+ current->comm, what);
return kernel_locked_down;
}
EXPORT_SYMBOL(__kernel_is_locked_down);
--
2.21.0.392.gf8f6787159e-goog