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)
Nov 19 2024, 6:15 AM
Unknown Object (File)
Oct 5 2024, 12:20 PM
Unknown Object (File)
Sep 18 2024, 2:29 AM
Unknown Object (File)
Sep 7 2024, 2:01 PM
Unknown Object (File)
Sep 5 2024, 5:10 PM
Unknown Object (File)
Aug 16 2024, 4:09 PM
Unknown Object (File)
Aug 7 2024, 6:06 AM
Unknown Object (File)
Jul 28 2024, 9:46 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.