linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Haass <vvvrrooomm@gmail.com>
To: Jessica Yu <jeyu@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-modules@vger.kernel.org
Subject: [PATCH] module support: during lockdown, log name of unsigned module
Date: Wed, 19 Feb 2020 10:02:17 +0100	[thread overview]
Message-ID: <CAH3oDPzeu_bzYa3fOUpcjQk4HJ5K2Rx+Qf+qbqxSrmTdrWHm5g@mail.gmail.com> (raw)

during lockdown loading of unsigned modules is restricted to signed
modules only. The old error message does not show which module misses
the signature, making it very difficult for a user to determine which
module is at fault.
This patch adds a line to the logs which additionally contains the
module name that caused the error message. The old message cannot
be replaced as it is generated by lockdown_is_locked_down
---
 kernel/module.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/kernel/module.c b/kernel/module.c
index 33569a01d6e..6dcb28139a0 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2807,7 +2807,8 @@ static int module_sig_check(struct load_info *info,
int flags)
  const unsigned long markerlen = sizeof(MODULE_SIG_STRING) - 1;
  const char *reason;
  const void *mod = info->hdr;
-
+ int is_locked = -EPERM;
+
  /*
  * Require flags == 0, as a module with version information
  * removed is no longer the module that was signed
@@ -2843,7 +2844,12 @@ static int module_sig_check(struct load_info *info,
int flags)
  return -EKEYREJECTED;
  }

- return security_locked_down(LOCKDOWN_MODULE_SIGNATURE);
+ is_locked = security_locked_down(LOCKDOWN_MODULE_SIGNATURE);
+ if (is_locked == -EPERM) {
+ pr_notice("Lockdown: %s: rejected module '%s' cause: %s",
+ current->comm, info->name, reason);
+ }
+ return is_locked;

  /* All other errors are fatal, including nomem, unparseable
  * signatures and signature check failures - even if signatures
-- 
2.25.0

             reply	other threads:[~2020-02-19  9:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-19  9:02 Martin Haass [this message]
2020-02-26 17:58 ` [PATCH] module support: during lockdown, log name of unsigned module Jessica Yu

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=CAH3oDPzeu_bzYa3fOUpcjQk4HJ5K2Rx+Qf+qbqxSrmTdrWHm5g@mail.gmail.com \
    --to=vvvrrooomm@gmail.com \
    --cc=jeyu@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).