Page MenuHomeFreeBSD

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

Authored by ivy on Fri, Apr 17, 12:49 AM.
Tags
None
Referenced Files
F153216545: D56457.diff
Sun, Apr 19, 9:01 PM
F153159218: D56457.diff
Sun, Apr 19, 1:04 PM
Unknown Object (File)
Sat, Apr 18, 8:43 AM
Unknown Object (File)
Sat, Apr 18, 5:56 AM
Unknown Object (File)
Sat, Apr 18, 5:55 AM
Unknown Object (File)
Sat, Apr 18, 5:07 AM
Unknown Object (File)
Fri, Apr 17, 2:04 PM
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.Fri, Apr 17, 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.Fri, Apr 17, 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.