linux-stable/scripts/mod
Fredrik Noring 54a7151b14 kbuild: modversions: Fix relative CRC byte order interpretation
Fix commit 56067812d5 ("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: 56067812d5 ("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>
2019-03-28 23:46:56 +09:00
..
.gitignore kbuild: trivial - remove trailing empty lines 2014-06-10 00:04:06 +02:00
devicetable-offsets.c platform-drivers-x86 for v5.1-1 2019-03-10 13:16:37 -07:00
empty.c
file2alias.c platform-drivers-x86 for v5.1-1 2019-03-10 13:16:37 -07:00
Makefile kbuild: move modpost out of 'scripts' target 2018-12-01 23:09:34 +09:00
mk_elfconfig.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
modpost.c kbuild: modversions: Fix relative CRC byte order interpretation 2019-03-28 23:46:56 +09:00
modpost.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
sumversion.c modpost: delete stale comment 2018-05-03 01:17:44 +09:00