* [Bug default/26135] Possible issue with type equality
2020-06-18 16:48 [Bug default/26135] New: Possible issue with type equality gprocida+abigail at google dot com
@ 2020-06-24 16:18 ` dodji at redhat dot com
2020-06-24 17:17 ` [Bug default/26135] Wrong linkage name causes anonymous classes miscomparison dodji at redhat dot com
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: dodji at redhat dot com @ 2020-06-24 16:18 UTC (permalink / raw)
To: libabigail
https://sourceware.org/bugzilla/show_bug.cgi?id=26135
dodji at redhat dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2020-06-24
Ever confirmed|0 |1
Status|UNCONFIRMED |ASSIGNED
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug default/26135] Wrong linkage name causes anonymous classes miscomparison
2020-06-18 16:48 [Bug default/26135] New: Possible issue with type equality gprocida+abigail at google dot com
2020-06-24 16:18 ` [Bug default/26135] " dodji at redhat dot com
@ 2020-06-24 17:17 ` dodji at redhat dot com
2020-06-24 17:22 ` dodji at redhat dot com
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: dodji at redhat dot com @ 2020-06-24 17:17 UTC (permalink / raw)
To: libabigail
https://sourceware.org/bugzilla/show_bug.cgi?id=26135
dodji at redhat dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Possible issue with type |Wrong linkage name causes
|equality |anonymous classes
| |miscomparison
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug default/26135] Wrong linkage name causes anonymous classes miscomparison
2020-06-18 16:48 [Bug default/26135] New: Possible issue with type equality gprocida+abigail at google dot com
2020-06-24 16:18 ` [Bug default/26135] " dodji at redhat dot com
2020-06-24 17:17 ` [Bug default/26135] Wrong linkage name causes anonymous classes miscomparison dodji at redhat dot com
@ 2020-06-24 17:22 ` dodji at redhat dot com
2020-06-24 17:22 ` dodji at redhat dot com
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: dodji at redhat dot com @ 2020-06-24 17:22 UTC (permalink / raw)
To: libabigail
https://sourceware.org/bugzilla/show_bug.cgi?id=26135
--- Comment #1 from dodji at redhat dot com ---
I can reproduce the issue. Thank you for raising it.
Based on my current understanding of the problem, I have put together the patch
that you can get from commit
https://sourceware.org/git/?p=libabigail.git;a=commit;h=7da86264ff2c0aff7ecf1c62dee9c0d64ed11798,
from the branch dodji/PR26135.
The branch can be browed at
https://sourceware.org/git/?p=libabigail.git;a=shortlog;h=refs/heads/dodji/PR26135.
Maybe you can test it in your environment and see if it addresses the problem
you were looking at?
For the curious reader, here is an explanation of the issue.
When comparing decls, the overload of the 'equals' function for
instances of decl_base compares their linkage names. If they are
different, then the decls are generally considered different.
Class declarations (and definitions) also use the 'equals' function
referred to above. So when two classes have different linkage names,
they are always considered different.
Now let's consider the case of an anonymous class. It doesn't have
any user-provided name, by definition. Libabigail does, however,
assigns it an internal name for various (internal) purposes. That
internal name is generally ignored for the purpose of (anonymous) type
comparison. So by design, two anonymous classes can have different
internal anonymous names and yet still happen to be equal.
The root issue in this problem report is that by default, the linkage
name of a class is set to its name. And when that class is anonymous,
its internal name is used as its linkage name. Oops. That leads to
anonymous classes being wrongly considered different.
This patch fixes the issue by providing additional constructors for a
class type to avoid using the internal anonymous name as its linkage
name.
Note that the same issue is present for unions so the patch does the
a similar thing for union types.
Enums are properly handled so we don't need to do anything in that
regard.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug default/26135] Wrong linkage name causes anonymous classes miscomparison
2020-06-18 16:48 [Bug default/26135] New: Possible issue with type equality gprocida+abigail at google dot com
` (2 preceding siblings ...)
2020-06-24 17:22 ` dodji at redhat dot com
@ 2020-06-24 17:22 ` dodji at redhat dot com
2020-06-25 14:56 ` gprocida+abigail at google dot com
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: dodji at redhat dot com @ 2020-06-24 17:22 UTC (permalink / raw)
To: libabigail
https://sourceware.org/bugzilla/show_bug.cgi?id=26135
dodji at redhat dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |WAITING
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug default/26135] Wrong linkage name causes anonymous classes miscomparison
2020-06-18 16:48 [Bug default/26135] New: Possible issue with type equality gprocida+abigail at google dot com
` (3 preceding siblings ...)
2020-06-24 17:22 ` dodji at redhat dot com
@ 2020-06-25 14:56 ` gprocida+abigail at google dot com
2020-07-06 17:14 ` dodji at redhat dot com
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: gprocida+abigail at google dot com @ 2020-06-25 14:56 UTC (permalink / raw)
To: libabigail
https://sourceware.org/bugzilla/show_bug.cgi?id=26135
--- Comment #2 from Giuliano Procida <gprocida+abigail at google dot com> ---
Hi.
Your change fixes the discrepancies my patch picked up.
It makes no difference to extracting kernel ABIs though.
It looks like it's safe to apply.
Thank you.
Regards,
Giuliano.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug default/26135] Wrong linkage name causes anonymous classes miscomparison
2020-06-18 16:48 [Bug default/26135] New: Possible issue with type equality gprocida+abigail at google dot com
` (4 preceding siblings ...)
2020-06-25 14:56 ` gprocida+abigail at google dot com
@ 2020-07-06 17:14 ` dodji at redhat dot com
2020-07-16 11:41 ` gprocida+abigail at google dot com
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: dodji at redhat dot com @ 2020-07-06 17:14 UTC (permalink / raw)
To: libabigail
https://sourceware.org/bugzilla/show_bug.cgi?id=26135
dodji at redhat dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|WAITING |RESOLVED
--- Comment #3 from dodji at redhat dot com ---
The patch was applied to upstream to the master branch at
https://sourceware.org/git/?p=libabigail.git;a=shortlog;h=refs/heads/master.
Thank you for taking the time to report this problem!
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug default/26135] Wrong linkage name causes anonymous classes miscomparison
2020-06-18 16:48 [Bug default/26135] New: Possible issue with type equality gprocida+abigail at google dot com
` (5 preceding siblings ...)
2020-07-06 17:14 ` dodji at redhat dot com
@ 2020-07-16 11:41 ` gprocida+abigail at google dot com
2020-07-16 18:32 ` gprocida+abigail at google dot com
2020-09-17 14:17 ` dodji at redhat dot com
8 siblings, 0 replies; 10+ messages in thread
From: gprocida+abigail at google dot com @ 2020-07-16 11:41 UTC (permalink / raw)
To: libabigail
https://sourceware.org/bugzilla/show_bug.cgi?id=26135
Giuliano Procida <gprocida+abigail at google dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |---
--- Comment #4 from Giuliano Procida <gprocida+abigail at google dot com> ---
Hi Dodji.
I was looking at type ids in another context and noticed the following.
$ git grep -c " id='type-id-24'"
346e88dd~1:tests/data/test-read-dwarf/PR22122-libftdc.so.abi
346e88dd~1:tests/data/test-read-dwarf/PR22122-libftdc.so.abi:138
$ git grep -c " id='type-id-24'"
346e88dd:tests/data/test-read-dwarf/PR22122-libftdc.so.abi
346e88dd:tests/data/test-read-dwarf/PR22122-libftdc.so.abi:708
While 138 declaration-only anonymous types sharing the same id (and so I
imagine the same canonical type) looks suspicious, 708 doing so is presumably
worse.
I'm sorry I didn't check the test files more carefully sooner.
Please take a look. Thanks.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug default/26135] Wrong linkage name causes anonymous classes miscomparison
2020-06-18 16:48 [Bug default/26135] New: Possible issue with type equality gprocida+abigail at google dot com
` (6 preceding siblings ...)
2020-07-16 11:41 ` gprocida+abigail at google dot com
@ 2020-07-16 18:32 ` gprocida+abigail at google dot com
2020-09-17 14:17 ` dodji at redhat dot com
8 siblings, 0 replies; 10+ messages in thread
From: gprocida+abigail at google dot com @ 2020-07-16 18:32 UTC (permalink / raw)
To: libabigail
https://sourceware.org/bugzilla/show_bug.cgi?id=26135
--- Comment #5 from Giuliano Procida <gprocida+abigail at google dot com> ---
This is the patch I was working on that caused me to take a closer look.
--- a/src/abg-dwarf-reader.cc
+++ b/src/abg-dwarf-reader.cc
@@ -3496,7 +3496,8 @@ public:
int tag = dwarf_tag(const_cast<Dwarf_Die*>(die));
if ((tag == DW_TAG_structure_type
|| tag == DW_TAG_class_type
- || tag == DW_TAG_union_type)
+ || tag == DW_TAG_union_type
+ || tag == DW_TAG_enumeration_type)
&& die_is_anonymous(die))
{
location l = die_location(*this, die);
This was an attempt to reduce the gap in behaviour between early and late type
canonicalisation by the DWARF reader.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug default/26135] Wrong linkage name causes anonymous classes miscomparison
2020-06-18 16:48 [Bug default/26135] New: Possible issue with type equality gprocida+abigail at google dot com
` (7 preceding siblings ...)
2020-07-16 18:32 ` gprocida+abigail at google dot com
@ 2020-09-17 14:17 ` dodji at redhat dot com
8 siblings, 0 replies; 10+ messages in thread
From: dodji at redhat dot com @ 2020-09-17 14:17 UTC (permalink / raw)
To: libabigail
https://sourceware.org/bugzilla/show_bug.cgi?id=26135
dodji at redhat dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|REOPENED |RESOLVED
--- Comment #6 from dodji at redhat dot com ---
(In reply to Giuliano Procida from comment #4)
> Hi Dodji.
>
> I was looking at type ids in another context and noticed the following.
>
> $ git grep -c " id='type-id-24'"
> 346e88dd~1:tests/data/test-read-dwarf/PR22122-libftdc.so.abi
> 346e88dd~1:tests/data/test-read-dwarf/PR22122-libftdc.so.abi:138
> $ git grep -c " id='type-id-24'"
> 346e88dd:tests/data/test-read-dwarf/PR22122-libftdc.so.abi
> 346e88dd:tests/data/test-read-dwarf/PR22122-libftdc.so.abi:708
>
> While 138 declaration-only anonymous types sharing the same id (and so I
> imagine the same canonical type) looks suspicious, 708 doing so is
> presumably worse.
I looked into this and it appears that the type with the ID "type-id-24" is an
anonymous class with no data member, no base classes, and which only contains
non-virtual member functions and/or some member type.
For classes containing no virtual member functions, only base classes and data
member are taken into account for identity.
So this seems normal to me. Furthermore, as we've been increasing the
likelihood of recognizing two anonymous types as equivalent, I rather find this
particular increase in duplicated ids as positive.
> I'm sorry I didn't check the test files more carefully sooner.
Nah, I think you've done great spotting this. This could have been a real
issue.
Incidentally, I have filed an enhancement request to detect pathological cases
of duplicated IDs at https://sourceware.org/bugzilla/show_bug.cgi?id=26591.
Thanks!
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 10+ messages in thread