Bug 29857 - abidiff coredump at abg-ir.cc:hash_as_canonical_type_or_constant when read libgs.so from ghostscript
Summary: abidiff coredump at abg-ir.cc:hash_as_canonical_type_or_constant when read li...
Status: RESOLVED FIXED
Alias: None
Product: libabigail
Classification: Unclassified
Component: default (show other bugs)
Version: unspecified
: P2 critical
Target Milestone: ---
Assignee: Dodji Seketeli
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-06 09:36 UTC by Xiaole He
Modified: 2022-12-22 02:07 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build: 2022-12-12 0:00
Last reconfirmed: 2022-12-12 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Xiaole He 2022-12-06 09:36:37 UTC
[Overview]
Executing 'abidiff' against to 'libgs.so' with version of 9.07 and 9.52 will cause coredump, the output from 'bt' command of 'gdb' shows below:

/* gdb output begin */
(gdb) bt
#0  0x0000fffe7e3666e0 in raise () from /lib64/libc.so.6
#1  0x0000fffe7e367a8c in abort () from /lib64/libc.so.6
#2  0x0000fffe7e35fb8c in ?? () from /lib64/libc.so.6
#3  0x0000fffe7e35fc0c in __assert_fail () from /lib64/libc.so.6
#4  0x0000fffe7eb67360 in abigail::ir::hash_as_canonical_type_or_constant (t=0x26646788) at abg-ir.cc:25934
#5  abigail::ir::hash_type (t=0x26646788) at abg-ir.cc:25814
...
#231 0x0000fffe7ec1c140 in abigail::comparison::default_reporter::diff_has_net_changes (this=<optimized out>, d=0x2e1bbf90) at abg-default-reporter.cc:38
#232 0x0000fffe7ebc20fc in abigail::comparison::corpus_diff::has_net_changes (this=0x2e1bbf90) at abg-comparison.cc:10679
#233 0x0000000000406174 in main (argc=<optimized out>, argv=<optimized out>) at abidiff.cc:1411
/* gdb output end */

[Steps to Reproduce]
(1)confirm that we at the latest master branch
# git remote -v
origin  git://sourceware.org/git/libabigail.git (fetch)
origin  git://sourceware.org/git/libabigail.git (push)
# git branch
* master
# git log -5 --oneline
1f51b9e8 (HEAD -> master, tag: libabigail-2.2, origin/master, origin/HEAD) Bug 29829 - dwarf-reader: Allow DIEs to be in a lexical block
ac53e88b dwarf-reader: Make die_peel_{qual_ptr,typedef} always set peeled type
4bdaf30b dwarf-reader: Avoid duplicating member functions
d222b447 dwarf-reader: Leverage ODR & DWZ
754364d5 Fix spurious deleted/added virtual destructor change report
# ./configure
# make
(2)assure the newly compiled 'abidiff' is linked to the newly compiled 'libabigail.so'
# pwd
/root/tmp/libabigail-git
# ldd tools/.libs/abidiff
        ...
        libabigail.so.1 => /root/tmp/libabigail-git/src/.libs/libabigail.so.1 (0x0000fffc59b00000)
        ...
(3)download 'libgs.so' with version of 9.07 and 9.52
# mkdir ghostscript/ && cd ghostscript/
# wget https://vault.centos.org/7.6.1810/os/x86_64/Packages/ghostscript-9.07-31.el7.x86_64.rpm
# wget http://debuginfo.centos.org/7/x86_64/ghostscript-debuginfo-9.07-31.el7.x86_64.rpm
# wget https://mirror.lzu.edu.cn/openeuler/openEuler-20.03-LTS-SP3/everything/x86_64/Packages/ghostscript-9.52-5.oe1.x86_64.rpm
# wget https://mirror.lzu.edu.cn/openeuler/openEuler-20.03-LTS-SP3/debuginfo/x86_64/Packages/ghostscript-debuginfo-9.52-5.oe1.x86_64.rpm
# mkdir 9.07-with-debug/ 9.07-without-debug/ 9.52-with-debug/ 9.52-without-debug/
# rpm2cpio ghostscript-9.07-31.el7.x86_64.rpm | cpio -idum -D 9.07-without-debug/
# rpm2cpio ghostscript-debuginfo-9.07-31.el7.x86_64.rpm | cpio -idum -D 9.07-with-debug/
# rpm2cpio ghostscript-9.52-5.oe1.x86_64.rpm | cpio -idum -D 9.52-without-debug/
# rpm2cpio ghostscript-debuginfo-9.52-5.oe1.x86_64.rpm | cpio -idum -D 9.52-with-debug/
# cd ../
(4)use newly compiled 'abidiff' to reproducing the problem that causes coredump
# ./tools/.libs/abidiff --d1 ghostscript/9.07-with-debug/usr/lib/debug/ --d2 ghostscript/9.52-with-debug/usr/lib/debug/ ghostscript/9.07-without-debug/usr/lib64/libgs.so.9.07 ghostscript/9.52-without-debug/usr/lib64/libgs.so.9.52

[Actual Results]
'abidiff' crashes with coredump:

/* crash output begin */
abidiff: abg-ir.cc:25934: size_t abigail::ir::hash_as_canonical_type_or_constant(const abigail::ir::type_base*): Assertion `__abg_cond__' failed.
Aborted (core dumped)
/* crash output end */

[Expected Results]
'abidiff' finishes normally with detail of abi differences.
Comment 1 Xiaole He 2022-12-09 03:46:38 UTC
A new found: this bug can be reproduced with libabigail of version 2.1, and the latest master branch of git repository. But it disappears with libabigail of version 2.0. The libabigail-2.0 we got is from: http://mirrors.kernel.org/sourceware/libabigail/libabigail-2.0.tar.gz
Comment 2 Dodji Seketeli 2022-12-20 09:27:17 UTC
This issue should be now fixed in the master branch of git repository by the following commits:

https://sourceware.org/git?p=libabigail.git;a=commit;h=10dd604e1813a70f0188bcd7492a46263871f33e

https://sourceware.org/git?p=libabigail.git;a=commit;h=fc71e519bb2bdae8182fd734d3b247d4b6469202

https://sourceware.org/git?p=libabigail.git;a=commit;h=88c6e080b636c45dc9e111ec45b5bbf7451012f6

Thanks for taking time to report this problem and sorry for the inconvenience.
Comment 3 Xiaole He 2022-12-22 02:07:22 UTC
(In reply to dodji from comment #2)
> This issue should be now fixed in the master branch of git repository by the
> following commits:
> 
> https://sourceware.org/git?p=libabigail.git;a=commit;
> h=10dd604e1813a70f0188bcd7492a46263871f33e
> 
> https://sourceware.org/git?p=libabigail.git;a=commit;
> h=fc71e519bb2bdae8182fd734d3b247d4b6469202
> 
> https://sourceware.org/git?p=libabigail.git;a=commit;
> h=88c6e080b636c45dc9e111ec45b5bbf7451012f6
> 
> Thanks for taking time to report this problem and sorry for the
> inconvenience.

Thank you for spending your precious time in resolving this problem.