Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

abi-dumper/eu-readelf "Integer overflow in hexadecimal number" on fedora:34 #28

Open
devjgm opened this issue Jun 8, 2021 · 7 comments · Fixed by #29
Open

abi-dumper/eu-readelf "Integer overflow in hexadecimal number" on fedora:34 #28

devjgm opened this issue Jun 8, 2021 · 7 comments · Fixed by #29

Comments

@devjgm
Copy link
Contributor

devjgm commented Jun 8, 2021

We recently upgraded our "abi-dumper" build from fedora:33 -> fedora:34 and we started seeing the following errors with our project google-cloud-cpp

$ abi-dumper /var/tmp/google-cloud-cpp/lib64/libgoogle_cloud_cpp_spanner_protos.so
WARNING: module version is not specified (-lver NUM)
Reading debug-info
Integer overflow in hexadecimal number at /usr/bin/abi-dumper line 1496, <$INFO_fh> line 17646.
Integer overflow in hexadecimal number at /usr/bin/abi-dumper line 1496, <$INFO_fh> line 223879.
ERROR: invalid debug_loc section of object, please fix your elf utils
Integer overflow in hexadecimal number at /usr/bin/abi-dumper line 1496, <$INFO_fh> line 326184.
...
^C

Looking at the eu-readelf output for one of the offending lines above (17646) we see that the output is:

$ eu-readelf --debug-dump=info /var/tmp/google-cloud-cpp/lib64/libgoogle_cloud_cpp_spanner_protos.so | cat -n | grep -C10 -P "\b17646\b"
 17636                   declaration          (flag_present) yes
 17637                   sibling              (ref4) [  91af]
 17638   [  91a9]          formal_parameter     abbrev: 2
 17639                     type                 (ref4) [ 30cd3]
 17640   [  91af]        member               abbrev: 277
 17641                   name                 (strp) "_M_head_impl"
 17642                   decl_file            (data1) tuple (56)
 17643                   decl_line            (data1) 125
 17644                   decl_column          (data1) 39
 17645                   type                 (ref4) [  8ebc]
 17646                   data_member_location (sdata) 18446744073709551615  # <--- BIG NUM: 2^64-1
 17647   [  91bd]        template_value_parameter abbrev: 118
 17648                   name                 (strp) "_Idx"
 17649                   type                 (ref4) [  e806]
 17650                   const_value          (data1) 1
 17651   [  91c7]        template_type_parameter abbrev: 35
 17652                   name                 (strp) "_Head"
 17653                   type                 (ref4) [  8ebc]
 17654   [  91d1]      const_type           abbrev: 19
 17655                 type                 (ref4) [  90d3]
 17656   [  91d6]      structure_type       abbrev: 60

In the above output the 18446744073709551615 (== 0xFFFFFFFFFFFFFFFF) is the number that's too big for the perl call to hex($2) in abi-dumper (it's also not hex).

The issue may be a bug in elfutils on Fedora 34. Note that there is also a line saying ERROR: invalid debug_loc section of object, please fix your elf utils in the first block.

However, it would be nice if abi-dumper could workaround this issue. A diff like the following seems to quiet the Integer overflow warnings for me:

--- /usr/bin/abi-dumper 2021-01-26 00:20:00.000000000 +0000
+++ /tmp/abi-dumper     2021-06-08 16:54:45.905900421 +0000
@@ -1493,9 +1493,11 @@

                 if($Val=~/\A\(\w+\)\s*(-?)(\w+)\Z/)
                 { # (data1) 1c
-                    $Val = hex($2);
-                    if($1) {
-                        $Val = -$Val;
+                    if ($2 != 0xFFFFFFFFFFFFFFFF) {
+                        $Val = hex($2);
+                        if($1) {
+                            $Val = -$Val;
+                       }
                     }
                 }
                 else
@linuxhw
Copy link

linuxhw commented Jun 8, 2021

Hi!

Thanks for the report!

Could you please attach the eu-readelf output?

@linuxhw
Copy link

linuxhw commented Jun 8, 2021

Also please share output of --debug-dump=loc for your object.

@devjgm
Copy link
Contributor Author

devjgm commented Jun 8, 2021

debug-dump-loc.txt.gz

@devjgm
Copy link
Contributor Author

devjgm commented Jun 8, 2021

The --debug-dump=info file is too big (26MB gzipped) and github will not allow me to attach it. bzip2 compressed it better, but GH won't let me upload a .bz2 file. So I've bzip2'd the file, then renamed it to have a .gz extension.
debug-dump-info.txt.actually-bzip2-not.gz

@linuxhw
Copy link

linuxhw commented Jun 9, 2021

The patch for the first part of the request looks reasonable. Would you like to create a pull request?

devjgm added a commit to devjgm/abi-dumper that referenced this issue Jun 9, 2021
Fixes: lvc#28
See that issue for the details.
@devjgm
Copy link
Contributor Author

devjgm commented Jun 9, 2021

Sure, I sent: #29

But if there are tests for this repo, I don't know how to run them.

@lvc lvc closed this as completed in #29 Jun 11, 2021
@lvc lvc reopened this Jun 11, 2021
@lvc
Copy link
Owner

lvc commented Jun 11, 2021

As I understand, the loc section is not presented anymore in your object and loclists is dumped instead. It has a different format and need to be parsed by abi-dumper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants