Hi, I recently attempted to install an out-of-tree module (an old version of the octeon mmc driver) on an octeon machine running big endian 32-bit mips. In this configuration, the kernel is 64-bit, but userspace is 32-bit. The module build failed with this error: of_device_id is defined like this in mod_devicetable.h: The size of this structure is 200 bytes and not 196 byte as modpost claims because the kernel is compiled as 64-bit (so the pointer at the end is 8 bytes instead of 4). I think there is a bug in the way Debian compiles modpost, because using upstream's modpost works correctly. I see that the real-XXX/devicetable-offsets.s file gets compiled with the target compiler, but not with the target flags so flags such as "-mabi=64 -mnoabicalls" which are used in 64-bit MIPS kernels are not used. This will cause the compiler to default to the userspace ABI which is 32-bit in this case. I'm not sure what the correct solution is here. Using the target flags directly might make modpost specific to a kernel flavour. Hacking in some special flags for mips* doesn't sound great either. I have not tested any other platforms, but I am guessing this issue will affect other platforms when the size of pointers in userspace and the kernel differ. James
Hi James, Going through some older bugreports for src:linux found the above; Is this still an issue? I have not digged deeper at all. Regards, Salvatore
Hi This bug was filed for a very old kernel or the bug is old itself without resolution. If you can reproduce it with - the current version in unstable/testing - the latest kernel from backports please reopen the bug, see https://www.debian.org/Bugs/server-control for details. Regards, Salvatore
Hi This bug was filed for a very old kernel or the bug is old itself without resolution. If you can reproduce it with - the current version in unstable/testing - the latest kernel from backports please reopen the bug, see https://www.debian.org/Bugs/server-control for details. Regards, Salvatore
Hello,
This is still reproducible in unstable (linux 7.2.12-1), with armhf
userland and the arm64 kernel.
Steps, as root on an arm64 machine:
mmdebstrap --variant=apt --architectures=armhf,arm64 \
--include=linux-headers-arm64:arm64 sid sid-armhf
chroot sid-armhf apt-get update
chroot sid-armhf apt-get install -y reform2-lpc-dkms
The DKMS build fails:
ERROR: modpost: reform2_lpc: type mismatch between of_tis_spi_match[] and
MODULE_DEVICE_TABLE(of, ...)
apt installs linux-kbuild-7.2.12+deb14:armhf to satisfy the headers'
dependency. Replacing it with the arm64 build makes the same DKMS build
succeed:
chroot sid-armhf apt-get install -y linux-kbuild-7.2.12+deb14:arm64
debian/rules.d/scripts/mod/Makefile.real generates devicetable-offsets.h
with the host compiler, and real-*/types.h only gives kernel_ulong_t the
size of the target. Pointer and long members keep the size of the host,
so in modpost.real-lsb-64 built on armhf, struct of_device_id is 196
bytes instead of 200. Upstream generates the offsets with the target
compiler, so it does not have this problem.
There are a few ways to fix this, but I can't think of one that's
obviously correct.
1. Generate the offsets for the 64-bit variants with a compiler for a
64-bit target. This gives the exact layout, but needs clang or a
cross gcc as a build dependency, and Debian has no 64-bit cross gcc
that runs on armhf.
2. Rewrite the pointer and long members of mod_devicetable.h as
kernel_ulong_t before generating the offsets. This needs no new
dependencies, but has to match the declarations in the header.
This came up on Raspberry Pi OS, where the 32-bit userland is used with
the 64-bit kernel.
Cheers,
Serge