Page MenuHomeFreeBSD

Handle kmod local relocation failures gracefully
ClosedPublic

Authored by mhorne on Oct 6 2020, 10:17 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Jul 1, 11:34 PM
Unknown Object (File)
Thu, Jun 13, 12:31 PM
Unknown Object (File)
Dec 20 2023, 7:13 AM
Unknown Object (File)
Nov 26 2023, 2:28 PM
Unknown Object (File)
Nov 22 2023, 7:26 PM
Unknown Object (File)
Nov 22 2023, 7:25 PM
Unknown Object (File)
Nov 22 2023, 6:44 PM
Unknown Object (File)
Nov 22 2023, 6:29 PM
Subscribers

Details

Summary

It is possible for elf_reloc_local() to fail in the unlikely case of
an unsupported relocation type. If this occurs, do not continue to
process the file. Also, print the symbol index as a hint to the user.

While here, make a couple of minor style adjustments.

If this version seems fine I will extend it to other architectures.

Test Plan

Forcing an unrecognized rtype causes kldload(8) to exit early.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

mhorne created this revision.
This revision is now accepted and ready to land.Oct 6 2020, 10:26 PM

Go ahead with style/printf changes in amd64/elf_machdep.c in advance.

sys/kern/link_elf_obj.c
1683 ↗(On Diff #77959)

Why ENOENT and not ENOEXEC ?

sys/kern/link_elf_obj.c
1683 ↗(On Diff #77959)

I wasn't sure of the exact usage of ENOEXEC, but it does seem more appropriate here. Will update.

Update after r366519. Return ENOEXEC rather than ENOENT.

This revision now requires review to proceed.Oct 7 2020, 6:50 PM
This revision is now accepted and ready to land.Oct 7 2020, 6:55 PM
This revision was automatically updated to reflect the committed changes.