Page MenuHomeFreeBSD

stand/common/load_elf: Do kernel module relocations for PPC
ClosedPublic

Authored by ivy on Apr 17 2026, 12:49 AM.
Tags
None
Referenced Files
F167518449: D56457.id175830.diff
Sat, Aug 22, 10:40 AM
Unknown Object (File)
Thu, Aug 20, 10:21 AM
Unknown Object (File)
Wed, Aug 19, 6:33 PM
Unknown Object (File)
Wed, Aug 19, 12:59 AM
Unknown Object (File)
Tue, Aug 18, 3:28 PM
Unknown Object (File)
Sun, Aug 16, 3:17 PM
Unknown Object (File)
Sat, Aug 15, 11:30 AM
Unknown Object (File)
Sat, Aug 15, 8:52 AM
Subscribers

Details

Summary

reloc_ptr() skips relocations for the kernel module, because on most
platforms the kernel is ET_EXEC and this is not required. On PPC,
the kernel is ET_DYN and we need to relocate here, otherwise the
module metadata will not be loaded properly and the kernel module
will have an incorrect version, preventing module dependencies from
resolving.

This fixes loading kernel modules from loader.conf on powerpc.

Diagnosed by: jrtc27
Sponsored by: https://www.patreon.com/bsdivy

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

ivy requested review of this revision.Apr 17 2026, 12:49 AM
adrian added a subscriber: adrian.

neat! why's the kernel ET_DYN on ppc anyway?

This revision is now accepted and ready to land.Apr 17 2026, 1:39 AM

I now understand why this case is there and am contemplating unifying the two paths so this condition can just be deleted even on non-PowerPC (it's more interesting on CHERI where even our ET_EXEC will have relocations for capabilities, but not integer addresses...), but for now this should be sufficient.