# [SOLVED] "Invalid module format" after update (not vermagic)

## Irayo

I updated kernel from 2.6 to 3.2.11, then remerged the proper modules packages (including ati-drivers).  The update was done by copying .config, running make oldconfig, setting symlink, compiling and installing as usual.  Reboot, re-merge kernel driver packages (ati-drivers).  This process has never failed before.  However this time, I get the "invalid module format" error on fglrx.

Other modules are working fine, but ati-drivers is still not cooperating.  It re-merges without any errors and detects the correct kernel version and location during compile.  The binary is put in the right place as well.

```

FATAL: Error inserting fglrx (/lib/modules/3.2.11-hardened/video/fglrx.ko): Invalid module format

```

I've checked and double checked the uname and vermagic strings and they match perfectly.  There is not even a dmesg output about mismatched vermagic.

```

# objdump -s /usr/src/linux/kernel/module.o|grep -A 5 '3\.2\.'

[...]

--

 0100 332e322e 31312d68 61726465 6e656420  3.2.11-hardened

 0110 534d5020 6d6f645f 756e6c6f 6164204b  SMP mod_unload K

 0120 45524e45 5845435f 4f522052 4546434f  ERNEXEC_OR REFCO

 0130 554e5420 47525345 43200000 00000000  UNT GRSEC ......

 0140 06000000 00000000 00000000 00000000  ................

 0150 02000000 00000000 01000000 00000000  ................

```

```

# modinfo -F vermagic fglrx

3.2.11-hardened SMP mod_unload KERNEXEC_OR REFCOUNT GRSEC

```

```

# uname -a

Linux ka 3.2.11-hardened #2 SMP Tue May 8 02:27:21 GMT 2012 x86_64 Intel(R) Core(TM)2 Quad CPU Q9450 @ 2.66GHz GenuineIntel GNU/Linux

```

(There is a space (0x20) after the GRSEC part of the vermagic in the kernel binary but I wouldn't think this would cause a problem.)

The only other thing I can think of would be a GCC version mismatch but that makes little sense as I didn't update or change versions of any packages between the kernel compile and module compile (and furthermore, I've recompiled both several times since without any improvement in this problem).

So does anyone know what the problem could be?

EDIT: Forgot to mention, there is absolutely no output in the dmesg when this happens (and none anywhere in dmesg about modules or fglrx or ati-drivers).  I also recompiled my kernel with forced module loading and ran 'modprobe -f' and it still gave this error.  I do not think the issue is vermagic, but I don't know what else could cause the error.Last edited by Irayo on Tue May 08, 2012 9:35 pm; edited 1 time in total

----------

## NeddySeagoon

Irayo,

Do other modules load ?

If all you did was a kernel update you missed the module-init-tools update.  You now need  sys-apps/kmod

----------

## Irayo

It appears that the problem is related to the following lines in kernel/module.c: (line 2517)

```

#ifdef CONFIG_PAX_KERNEXEC_PLUGIN_METHOD_OR

        if (!license || !license_is_gpl_compatible(license))

                return -ENOEXEC;

#endif

```

Unknown to me, one of the new default settings in the hardened kernel breaks binary modules.  Switching the KERNEXEC plugin method in the config fixed everything.

Sadly no output is printed to the dmesg when this happens, and there is no mention of it anywhere except a half-sentence in the config documentation, so I only found it by digging in the source file.  Perhaps someone (either here or even better, upstream) should add a printk here to avoid others in the future having the same trouble.

As for the kmod package, all available versions seem to be masked here (~amd64) and I don't have kmod installed.  However, I have the latest module-init-tools, and the module still loads fine after making the config change noted above.  So I'm not sure exactly what kmod would change.

Thanks,

Irayo

----------

## NeddySeagoon

Irayo,

Please post a bug at bugs.gentoo.org, if one does not exist already.  That way it will get into the hardened teams workflow.

----------

