binutils-gdb/libctf
Nick Alcock 999e7ed7a2 libctf: ctf-link outdated input check faulty
This check has a pair of faults which, combined, can lead to memory
corruption.  Firstly, it assumes that the values of the ctf_link_inputs
hash are ctf_dict_t's: they are not, they are ctf_link_input_t's, a much
shorter structure.  So the flags check which is the core of this is
faulty (but happens, by chance, to give the right output on most
architectures, since usually we happen to get a 0 here, so the test that
checks this usually passes).  Worse, the warning that is emitted when
the test fails is added to the wrong dict -- it's added to the input
dict, whose warning list is never consumed, rendering the whole check
useless.  But the dict it adds to is still the wrong type, so we end up
overwriting something deep in memory (or, much more likely,
dereferencing a garbage pointer and crashing).

Fixing both reveals another problem: the link input is an *archive*
consisting of multiple members, so we have to consider whether to check
all of them for the outdated-func-info thing we are checking here.
However, no compiler exists that emits a mixture of members with this
flag on and members with it off, and the linker always reserializes (and
upgrades) such things when it sees them: so all members in a given
archive must have the same value of the flag, so we only need to check
one member per input archive.

libctf/
	PR libctf/29983
	* ctf-link.c (ctf_link_warn_outdated_inputs): Get the types of
        members of ctf_link_inputs right, fixing a possible spurious
        tesst failure / wild pointer deref / overwrite.  Emit the
        warning message into the right dict.
2023-01-12 15:23:51 +00:00
..
doc Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
testsuite Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
.gitignore
aclocal.m4 libctf: remove unnecessary zstd constructs 2022-12-12 10:53:39 -08:00
ChangeLog Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ChangeLog-2020
config.h.in libctf: remove unnecessary zstd constructs 2022-12-12 10:53:39 -08:00
configure libctf: remove unnecessary zstd constructs 2022-12-12 10:53:39 -08:00
configure.ac Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-archive.c Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-create.c Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-decl.c Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-decls.h Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-dedup.c Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-dump.c Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-endian.h Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-error.c Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-hash.c Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-impl.h Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-inlines.h Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-intl.h Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-labels.c Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-link.c libctf: ctf-link outdated input check faulty 2023-01-12 15:23:51 +00:00
ctf-lookup.c Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-open-bfd.c Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-open.c Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-qsort_r.c Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-serialize.c Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-sha1.c Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-sha1.h Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-string.c Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-subr.c Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-types.c Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
ctf-util.c Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
elf.h Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
libctf.ver Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
Makefile.am Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
Makefile.in Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30
NEWS
swap.h Update year range in copyright notice of binutils files 2023-01-04 22:14:02 +10:30