]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
kbuild: modversions: Fix relative CRC byte order interpretation
authorFredrik Noring <noring@nocrew.org>
Wed, 27 Mar 2019 18:12:50 +0000 (19:12 +0100)
committerMasahiro Yamada <yamada.masahiro@socionext.com>
Thu, 28 Mar 2019 14:46:56 +0000 (23:46 +0900)
commit54a7151b1496cddbb7a83546b7998103e98edc88
tree7978c193359384f6aaa1772dc14cd50c06a80f68
parent7fcddf7c004140052d6f72273a0455239ad49112
kbuild: modversions: Fix relative CRC byte order interpretation

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>
scripts/mod/modpost.c