Re: git: 68396709e73a - releng/12.3 - libctf: Improve check for duplicate SOU definitions in ctf_add_type()

From: Shawn Webb <shawn.webb_at_hardenedbsd.org>
Date: Mon, 22 Nov 2021 17:25:44 UTC
On Mon, Nov 22, 2021 at 04:34:50PM +0000, Mark Johnston wrote:
> The branch releng/12.3 has been updated by markj:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=68396709e73a4cd392ffc06fde6bfa44d79118a7
> 
> commit 68396709e73a4cd392ffc06fde6bfa44d79118a7
> Author:     Mark Johnston <markj@FreeBSD.org>
> AuthorDate: 2021-10-04 16:28:22 +0000
> Commit:     Mark Johnston <markj@FreeBSD.org>
> CommitDate: 2021-11-22 16:32:18 +0000
> 
>     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.

Hey Mark,

Out of curiosity, would commits to releng branches necessitate an EN?

Thanks,

-- 
Shawn Webb
Cofounder / Security Engineer
HardenedBSD

https://git.hardenedbsd.org/hardenedbsd/pubkeys/-/raw/master/Shawn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc