8sa1-binutils-gdb/libctf
Nick Alcock afd78bd6f0 libctf, create: do not corrupt function types' arglists at insertion time
ctf_add_function assumes that function types' arglists are of type
ctf_id_t.  Since they are CTF IDs, they are 32 bits wide, a uint32_t:
unfortunately ctf_id_t is a forward-compatible user-facing 64 bits wide,
and should never ever reach the CTF storage level.

All the CTF code other than ctf_add_function correctly assumes that
function arglists outside dynamic containers are 32 bits wide, so the
serialization machinery ends up cutting off half the arglist, corrupting
all args but the first (a good sign is a bunch of args of ID 0, the
unimplemented type, popping up).

Fix this by copying the arglist into place item by item, casting it
properly, at the same time as we validate the arg types.  Fix the type
of the dtu_argv in the dynamic container and drop the now-unnecessary
cast in the serializer.

libctf/
	* ctf-impl.h (ctf_dtdef_t) <dtu_argv>: Fix type.
	* ctf-create.c (ctf_add_function): Check for unimplemented type
	and populate at the same time.  Populate one-by-one, not via
	memcpy.
	(ctf_serialize): Remove unnecessary cast.
	* ctf-types.c (ctf_func_type_info): Likewise.
	(ctf_func_type_args): Likewise.  Fix comment typo.
2020-07-22 17:57:22 +01:00
..
.gitignore libctf: restructure error handling to reduce relocations 2020-07-22 17:57:20 +01:00
aclocal.m4 libctf: support platforms with separate libintl 2020-06-26 15:56:39 +01:00
ChangeLog libctf, create: do not corrupt function types' arglists at insertion time 2020-07-22 17:57:22 +01:00
config.h.in libctf: support platforms with separate libintl 2020-06-26 15:56:39 +01:00
configure libctf: support platforms with separate libintl 2020-06-26 15:56:39 +01:00
configure.ac libctf: support platforms with separate libintl 2020-06-26 15:56:39 +01:00
ctf-archive.c Fix problems in CTF handling code exposed by the Coverity static analysis tool. 2020-07-22 16:07:48 +01:00
ctf-create.c libctf, create: do not corrupt function types' arglists at insertion time 2020-07-22 17:57:22 +01:00
ctf-decl.c
ctf-decls.h
ctf-dump.c
ctf-endian.h
ctf-error.c libctf: restructure error handling to reduce relocations 2020-07-22 17:57:20 +01:00
ctf-hash.c
ctf-impl.h libctf, create: do not corrupt function types' arglists at insertion time 2020-07-22 17:57:22 +01:00
ctf-labels.c
ctf-link.c
ctf-lookup.c
ctf-open-bfd.c libctf: add some missing #includes. 2020-06-26 15:56:39 +01:00
ctf-open.c libctf: create: non-root-visible types should not appear in name tables 2020-06-26 15:56:39 +01:00
ctf-qsort_r.c
ctf-string.c
ctf-subr.c
ctf-types.c libctf, create: do not corrupt function types' arglists at insertion time 2020-07-22 17:57:22 +01:00
ctf-util.c
elf.h
libctf.ver libctf, binutils: support CTF archives like objdump 2020-06-26 15:56:39 +01:00
Makefile.am libctf: restructure error handling to reduce relocations 2020-07-22 17:57:20 +01:00
Makefile.in libctf: restructure error handling to reduce relocations 2020-07-22 17:57:20 +01:00
mkerrors.sed libctf: restructure error handling to reduce relocations 2020-07-22 17:57:20 +01:00
swap.h libctf, elfcpp, gold: do not assume that <byteswap.h> contains bswap_* 2020-06-26 15:56:39 +01:00