Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp364306ybv; Wed, 19 Feb 2020 01:04:12 -0800 (PST) X-Google-Smtp-Source: APXvYqxQWvkCiBEOo+c0xwCWEB3oZnj1CUQ+1spXHt28p3EYW8S2OeU7P9sAf+Upxrizfj8jF9+M X-Received: by 2002:aca:c1c2:: with SMTP id r185mr4095785oif.19.1582103052893; Wed, 19 Feb 2020 01:04:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582103052; cv=none; d=google.com; s=arc-20160816; b=hbCBON5meCpUkrAYyDzJDW3CT5os+4S1DsMmrtcdxMhhgVyAYhIZtDht1hM/05rla8 cjVXvWJ/seRZxBXm7x1gX0M22HnrpyOKgcpjylTmJh/ddIs2f37Of7862s6FRB4zi/6E n+LaGc5fvrSwwzjP0Lo1S2WZazdnFf3DKIRzBpAwp7t1Nak6FPQSac/JLtFqeC83bH92 UQDZlSb7DN7r780xHSKR90AD23dGTmPeblUaMHYq9LGi5mk/TyyJR9vGqsnbdh5+Rp5u 7KZHaTir/EeS/kc8WVZqugl5NgNxoC3w9CSuSGVoEeop0NsHaD4IDaqjPTOlYup5vGd0 r93w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :mime-version:dkim-signature; bh=TSVyOEZZlUXcItl/vOCqMLuW1ofkxTSLhKQ7okp+WUw=; b=pixyHyDLUfCbc0lWw8OkA8M4byZnHeayK+MdCiuRJvWt9wPF/+DtG7w9xaZnQ2DKLN W5KHK2VBW/Ge+YzUWF/+tBOsTinMjHeq/HCnAgSQ1enS91lCodLsJ5IHGqO79yIE/+1H X9eNWXn3Z/G0Me9a6M61jrFgCrzCYxnnse8mjzKmcMi8fWcywxb/4ByhYNdJ/Hh6Yznc Njt42BqsVhYjFXn7hVOe5obK6CVG6yvlLEOF0CM1mkEpX2mnQR6IIXKpMrZwawB2G0JE uud+W0WR/GlNEnQ7aiMHaO5bOifrfUz7ncD9o0zghmW9X63I2A3PsM5X5B0MZw4Xkh3X D0Ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=W+MvosDD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i25si9388614oii.259.2020.02.19.01.03.59; Wed, 19 Feb 2020 01:04:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=W+MvosDD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726680AbgBSJCf (ORCPT + 99 others); Wed, 19 Feb 2020 04:02:35 -0500 Received: from mail-vs1-f67.google.com ([209.85.217.67]:41403 "EHLO mail-vs1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726260AbgBSJCf (ORCPT ); Wed, 19 Feb 2020 04:02:35 -0500 Received: by mail-vs1-f67.google.com with SMTP id k188so14600110vsc.8; Wed, 19 Feb 2020 01:02:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=TSVyOEZZlUXcItl/vOCqMLuW1ofkxTSLhKQ7okp+WUw=; b=W+MvosDDNezGY0Xz11wcWD5F1iPFX3ljmRkbHSfE1anrFuYDdb5UEvX8Fd8FSEH9fK g8XNmermebanajz8wUzJv6E7+Lpo9m7pUKQ8ZjMH8YxkLRrPGILV6HWQ4eHw5XDZ53IT JtSiHbAegJIwYSLSM1i75JFwskZoZYZmkoHBZr3guFZvzpisQLR5P/3OZjhatToz49LT W008XH5uN98RYQ5w1FVVPIiAj2mk8Kqji8aeT4695uKAsTwWkkJCOIw992VqU97Pyepv JZaJ0Dnq2IVvJ2db4U3xYnlHdTyVasQ1eT9IhbblNbuRuTspOSdoXH7PKohvp1PxIh0S FggA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=TSVyOEZZlUXcItl/vOCqMLuW1ofkxTSLhKQ7okp+WUw=; b=TlmEhK8ARvxQkU8jlX5bg7aNkDbWxL8i/WnNwIFGPnh9Ib+TD7y4dsaKre2HRsHSkV V7+V+exlO+8l9wXqaKTpWC2HaXLWnqUSJ99gI/lnMcGsd4esdyX7qhE6w+LG06Llh7Pa xJ/C3rmCgEACwpdDS8K1bLfDCCOIO8psOn8Z9NdbQFzhyS3BnTlfvmFES2exo44yb6+x cHH0KxP57XLuJLiW77fcwPCv3UcXXXUXTooMN3pbPL+39NZoQkfcj91BGbXina/FpZ38 iavDo8OMjhh/+rJdxK6zJNAqUm1C1HFAILdpfVQyJ24S3H6t+DFjlURbjKHdmeyf1vom GukA== X-Gm-Message-State: APjAAAUP+NucwGvTHrsMpGC4Ubmc6J8JFKXDwmB30EyRVrvESFjVeuK+ zcGUmP/J4ON01HMxKQmF42nYF4rQ4lFstlbf3uk= X-Received: by 2002:a67:eac5:: with SMTP id s5mr13315040vso.148.1582102954243; Wed, 19 Feb 2020 01:02:34 -0800 (PST) MIME-Version: 1.0 From: Martin Haass Date: Wed, 19 Feb 2020 10:02:17 +0100 Message-ID: Subject: [PATCH] module support: during lockdown, log name of unsigned module To: Jessica Yu Cc: linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, linux-modules@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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