Skip to content

Commit a97ac8c

Browse files
dtormcgrof
authored andcommitted
module: fix signature check failures when using in-kernel decompression
The new flag MODULE_INIT_COMPRESSED_FILE unintentionally trips check in module_sig_check(). The check was supposed to catch case when version info or magic was removed from a signed module, making signature invalid, but it was coded too broadly and was catching this new flag as well. Change the check to only test the 2 particular flags affecting signature validity. Fixes: b1ae6dc ("module: add in-kernel support for decompressing") Signed-off-by: Dmitry Torokhov <[email protected]> Reviewed-by: Douglas Anderson <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]>
1 parent 285ac8d commit a97ac8c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

kernel/module.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2883,12 +2883,13 @@ static int module_sig_check(struct load_info *info, int flags)
28832883
const unsigned long markerlen = sizeof(MODULE_SIG_STRING) - 1;
28842884
const char *reason;
28852885
const void *mod = info->hdr;
2886-
2886+
bool mangled_module = flags & (MODULE_INIT_IGNORE_MODVERSIONS |
2887+
MODULE_INIT_IGNORE_VERMAGIC);
28872888
/*
2888-
* Require flags == 0, as a module with version information
2889-
* removed is no longer the module that was signed
2889+
* Do not allow mangled modules as a module with version information
2890+
* removed is no longer the module that was signed.
28902891
*/
2891-
if (flags == 0 &&
2892+
if (!mangled_module &&
28922893
info->len > markerlen &&
28932894
memcmp(mod + info->len - markerlen, MODULE_SIG_STRING, markerlen) == 0) {
28942895
/* We truncate the module to discard the signature */

0 commit comments

Comments
 (0)