Page MenuHomeFreeBSD

loader: fix elf lookup_symbol type filtering
ClosedPublic

Authored by kevans on Oct 13 2022, 2:25 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 7, 4:18 PM
Unknown Object (File)
Tue, Nov 4, 4:00 AM
Unknown Object (File)
Mon, Oct 27, 4:17 AM
Unknown Object (File)
Sat, Oct 25, 4:08 AM
Unknown Object (File)
Oct 16 2025, 3:45 PM
Unknown Object (File)
Oct 15 2025, 11:39 PM
Unknown Object (File)
Oct 14 2025, 1:07 PM
Unknown Object (File)
Oct 9 2025, 8:42 PM
Subscribers

Details

Summary

The existing logic doesn't seem to make much sense, as we won't filter
on the type if st_shndx != SHN_UNDEF. In practice, this breaks booting
12.3 kernels on newer loaders, as they do have a kernphys symbol of
the wrong type (NOTYPE, rather than OBJECT) -- we end up deriving the
wrong value for copy_staging.

It's unclear if this version makes any more sense, but it seems to match
what rtld's matched_symbol() does. Loader doesn't need to care about
STT_FUNC w/ UND shndx, because we won't encounter those; in kmods,
undefined (kernel) functions are NOTYPE.

Diff Detail

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