]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
loader: fix elf lookup_symbol type filtering
authorKyle Evans <kevans@FreeBSD.org>
Fri, 14 Oct 2022 03:06:13 +0000 (22:06 -0500)
committerMark Johnston <markj@FreeBSD.org>
Tue, 1 Nov 2022 18:03:25 +0000 (14:03 -0400)
commit1ee7e4ba70e10e0ac0c9c144ad0301ffeca8824d
treef915a6e6bf74b1b36a91aec85b1104b0e2178c5b
parent0bcdf24a7cf33272d1ea08d3ad7e4b95f0308e33
loader: fix elf lookup_symbol type filtering

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.

Approved by: so
Security: FreeBSD-EN-22:27.loader
Reported by: Christian McDonald <cmcdonald netgate com>
Reviewed by: imp, kib, tsoome

(cherry picked from commit 0701dbda94f21de8ddab3113f79262a26cc7b96c)
(cherry picked from commit 2b31059ea701957584e68a75857206d80a230211)
stand/common/load_elf.c