1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-05 09:14:03 +00:00
freebsd/cddl
Mark Johnston 105fd928b0 libctf: Improve check for duplicate SOU definitions in ctf_add_type()
When copying a struct or union from one CTF container to another,
ctf_add_type() checks whether it matches an existing type in the
destination container.  It does so by looking for a type with the same
name and kind as the new type, and if one exists, it iterates over all
members of the source type and checks whether a member with matching
name and offset exists in the matched destination type.  This can
produce false positives, for example because member types are not
compared, but this is not expected to arise in practice.  If the match
fails, ctf_add_type() returns an error.

The procedure used for member comparison breaks down in the face of
anonymous struct and union members.  ctf_member_iter() visits each
member in the source definition and looks up the corresponding member in
the desination definition by name using ctf_member_info(), but this
function will descend into anonymous members and thus fail to match.
Fix the problem by introducing a custom comparison routine which does
not assume member names are unique.  This should also be faster for
types with many members; in the previous scheme, membcmp() would perform
a linear scan of the desination type's members to perform a lookup by
name.  The new routine steps through the members of both types in a
single loop.

PR:		258763
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2021-10-04 12:28:22 -04:00
..
compat/opensolaris Delete obsolete Solaris compat files 2021-05-24 08:48:47 -06:00
contrib/opensolaris libctf: Improve check for duplicate SOU definitions in ctf_add_type() 2021-10-04 12:28:22 -04:00
lib pkgbase: Put dtrace in its own package 2021-06-19 17:49:31 +02:00
sbin zfs: merge openzfs/zfs@afa7b3484 (master) into main 2021-06-13 04:38:47 +02:00
share zfs: merge openzfs/zfs@75b4cbf62 (master) into main 2021-06-08 16:52:44 +02:00
tests
usr.bin zfs: change zstream -> zstreamdump link into a symlink 2021-06-13 05:40:18 +02:00
usr.libexec zfs: attach zpool_influxdb to build 2021-07-07 20:15:12 +02:00
usr.sbin pkgbase: Create a FreeBSD-dwatch package 2021-09-07 10:20:40 +02:00
Makefile zfs: attach zpool_influxdb to build 2021-07-07 20:15:12 +02:00
Makefile.inc Do a sweep and remove most WARNS=6 settings 2020-10-01 01:10:51 +00:00