diff options
author | Jessica Yu <jeyu@kernel.org> | 2018-06-29 10:37:08 -0400 |
---|---|---|
committer | Jessica Yu <jeyu@kernel.org> | 2018-07-02 05:36:17 -0400 |
commit | f314dfea16a085a58d2ff227ea9fa9e490ee5d18 (patch) | |
tree | c203005916d88e491f9cf333929ca9830a84277d /kernel/module_signing.c | |
parent | 996302c5e85650722f1e5aeaeaaac12f9f362bf8 (diff) |
modsign: log module name in the event of an error
Now that we have the load_info struct all initialized (including
info->name, which contains the name of the module) before
module_sig_check(), make the load_info struct and hence module name
available to mod_verify_sig() so that we can log the module name in the
event of an error.
Signed-off-by: Jessica Yu <jeyu@kernel.org>
Diffstat (limited to 'kernel/module_signing.c')
-rw-r--r-- | kernel/module_signing.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/kernel/module_signing.c b/kernel/module_signing.c index 937c844bee4a..f2075ce8e4b3 100644 --- a/kernel/module_signing.c +++ b/kernel/module_signing.c | |||
@@ -45,10 +45,10 @@ struct module_signature { | |||
45 | /* | 45 | /* |
46 | * Verify the signature on a module. | 46 | * Verify the signature on a module. |
47 | */ | 47 | */ |
48 | int mod_verify_sig(const void *mod, unsigned long *_modlen) | 48 | int mod_verify_sig(const void *mod, struct load_info *info) |
49 | { | 49 | { |
50 | struct module_signature ms; | 50 | struct module_signature ms; |
51 | size_t modlen = *_modlen, sig_len; | 51 | size_t sig_len, modlen = info->len; |
52 | 52 | ||
53 | pr_devel("==>%s(,%zu)\n", __func__, modlen); | 53 | pr_devel("==>%s(,%zu)\n", __func__, modlen); |
54 | 54 | ||
@@ -62,10 +62,11 @@ int mod_verify_sig(const void *mod, unsigned long *_modlen) | |||
62 | if (sig_len >= modlen) | 62 | if (sig_len >= modlen) |
63 | return -EBADMSG; | 63 | return -EBADMSG; |
64 | modlen -= sig_len; | 64 | modlen -= sig_len; |
65 | *_modlen = modlen; | 65 | info->len = modlen; |
66 | 66 | ||
67 | if (ms.id_type != PKEY_ID_PKCS7) { | 67 | if (ms.id_type != PKEY_ID_PKCS7) { |
68 | pr_err("Module is not signed with expected PKCS#7 message\n"); | 68 | pr_err("%s: Module is not signed with expected PKCS#7 message\n", |
69 | info->name); | ||
69 | return -ENOPKG; | 70 | return -ENOPKG; |
70 | } | 71 | } |
71 | 72 | ||
@@ -76,7 +77,8 @@ int mod_verify_sig(const void *mod, unsigned long *_modlen) | |||
76 | ms.__pad[0] != 0 || | 77 | ms.__pad[0] != 0 || |
77 | ms.__pad[1] != 0 || | 78 | ms.__pad[1] != 0 || |
78 | ms.__pad[2] != 0) { | 79 | ms.__pad[2] != 0) { |
79 | pr_err("PKCS#7 signature info has unexpected non-zero params\n"); | 80 | pr_err("%s: PKCS#7 signature info has unexpected non-zero params\n", |
81 | info->name); | ||
80 | return -EBADMSG; | 82 | return -EBADMSG; |
81 | } | 83 | } |
82 | 84 | ||