summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorFredrik Noring <noring@nocrew.org>2019-03-27 19:12:50 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-04-03 06:26:23 +0200
commitaa7f29f870278fca449a26e990717a46ec93834a (patch)
treec716bebc0835aeac3ed5cd1cad0dd2aaf3ba62f1 /scripts
parent4dfae837ceafddc177d2dc2aaad7f8c463055685 (diff)
downloadlinux-stable-aa7f29f870278fca449a26e990717a46ec93834a.tar.gz
linux-stable-aa7f29f870278fca449a26e990717a46ec93834a.tar.bz2
linux-stable-aa7f29f870278fca449a26e990717a46ec93834a.zip
kbuild: modversions: Fix relative CRC byte order interpretation
commit 54a7151b1496cddbb7a83546b7998103e98edc88 upstream. Fix commit 56067812d5b0 ("kbuild: modversions: add infrastructure for emitting relative CRCs") where CRCs are interpreted in host byte order rather than proper kernel byte order. The bug is conditional on CONFIG_MODULE_REL_CRCS. For example, when loading a BE module into a BE kernel compiled with a LE system, the error "disagrees about version of symbol module_layout" is produced. A message such as "Found checksum D7FA6856 vs module 5668FAD7" will be given with debug enabled, which indicates an obvious endian problem within __kcrctab within the kernel image. The general solution is to use the macro TO_NATIVE, as is done in similar cases throughout modpost.c. With this correction it has been verified that a BE kernel compiled with a LE system accepts BE modules. This change has also been verified with a LE kernel compiled with a LE system, in which case TO_NATIVE returns its value unmodified since the byte orders match. This is by far the common case. Fixes: 56067812d5b0 ("kbuild: modversions: add infrastructure for emitting relative CRCs") Signed-off-by: Fredrik Noring <noring@nocrew.org> Cc: stable@vger.kernel.org Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/mod/modpost.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 5a77efd39b3f..858cbe56b100 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -640,7 +640,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
info->sechdrs[sym->st_shndx].sh_offset -
(info->hdr->e_type != ET_REL ?
info->sechdrs[sym->st_shndx].sh_addr : 0);
- crc = *crcp;
+ crc = TO_NATIVE(*crcp);
}
sym_update_crc(symname + strlen("__crc_"), mod, crc,
export);