Skip to contentSkip to conversation

module: treat exit sections the same as init sections when !CONFIG_MODULE_UNLOAD

PATCH In review Joerg Vehlow 2 participants 3 messages May 23, 2022 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 module: treat exit sections the same as init sections when !CONFIG_MODULE_UNLOAD

Hi,

this mainline patch 33121347fb1c359bd6e3e680b9f2c6ced5734a8 should be applied to 5.15 as well.
Without loading of some modules fails, if
1. MODULE_UNLOAD=n
2. Architecture is aarch64 (maybe others as well)
3. KASLR is active

Without this patch the symbol .exit.text is not relocated and when the linker generated a relative 32 bit relocation(PREL32) and the module is loaded far enough away from the default loading address, it will trigger a relocation overflow like this:

module algif_hash: overflow in relocation type 261 val ffff800010051c20

This happens to all modules, that use BUG in the exit section or if the compiler generates a jump table in the exit section.

Thanks,
Joerg

maintainer
#1 lore raw
Quoted 4 lines · Joerg Vehlow

Hi,

this mainline patch 33121347fb1c359bd6e3e680b9f2c6ced5734a8 should be applied to 5.15 as well.

You mean 5.10, right? It's already in 5.13 and newer releases

Quoted 10 lines

Without loading of some modules fails, if
1. MODULE_UNLOAD=n
2. Architecture is aarch64 (maybe others as well)
3. KASLR is active

Without this patch the symbol .exit.text is not relocated and when the linker generated a relative 32 bit relocation(PREL32) and the module is loaded far enough away from the default loading address, it will trigger a relocation overflow like this:

Quoted 4 lines

module algif_hash: overflow in relocation type 261 val ffff800010051c20

This happens to all modules, that use BUG in the exit section or if the compiler generates a jump table in the exit section.

Now queued up for 5.10.y, thanks.

greg k-h

#2 lore raw

Hi Greg,

Am 5/23/2022 um 5:15 PM schrieb Greg KH:

Quoted 7 lines · Joerg Vehlow
Quoted 4 lines

Hi,

this mainline patch 33121347fb1c359bd6e3e680b9f2c6ced5734a8 should be applied to 5.15 as well.

You mean 5.10, right? It's already in 5.13 and newer releases

Yes of course, I even put it correct in the subject...

Quoted 11 lines
Quoted 11 lines

Without loading of some modules fails, if
1. MODULE_UNLOAD=n
2. Architecture is aarch64 (maybe others as well)
3. KASLR is active

Without this patch the symbol .exit.text is not relocated and when the linker generated a relative 32 bit relocation(PREL32) and the module is loaded far enough away from the default loading address, it will trigger a relocation overflow like this:

Quoted 6 lines
Quoted 4 lines

module algif_hash: overflow in relocation type 261 val ffff800010051c20

This happens to all modules, that use BUG in the exit section or if the compiler generates a jump table in the exit section.

Now queued up for 5.10.y, thanks.

Thanks

Quoted 2 lines

greg k-h

Joerg