3

I see in some driver source code the line:

MODULE_INFO(retpoline, "Y")

What is does?

red0ct
  • 4,840
  • 3
  • 17
  • 44
Itay Avraham
  • 329
  • 1
  • 3
  • 15

1 Answers1

2

This macro defines key-value pairs that are stored in the compiled module files. You can use the modinfo command to display them. For example, when you compile this module, modinfo my_module.ko will include a line

retpoline:      Y

You can find the definition of the macro and its documentation (such as it is) by searching on an LXR interface. It works by defining a symbol in the .modinfo section of the object file.

This mechanism is used for various metadata used by the module loaded in the kernel and by userland tools such as modprobe. Standard metadata include aliases, license, version, etc.

The retpoline tag indicates that the module is built with support for a mitigation against Spectre. I don't know why driver source code would declare this explicitly: as far as I understand, this should automatically be inserted (via a header) when compiling with retpoline support: this is a compiler feature, not a property of the source code.

Gilles 'SO- stop being evil'
  • 104,111
  • 38
  • 209
  • 254