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

[PATCH] fix symbol search loop at debuglink mode #70

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pavel-orekhov
Copy link

Some distribs like ubuntu'18 creatively name files with debug symbols.
(same name without .debug suffix). And give no build-id way.

$dpkg -L libc6-dbg | grep -v gconv
/usr/lib/debug/.build-id/68/f36706eb2e6eee4046c4fdca2a19540b2f6113.debug
/usr/lib/debug/lib/x86_64-linux-gnu/libc-2.27.so

$ dpkg -L libc6
/lib/x86_64-linux-gnu/libc-2.27.so
/lib/x86_64-linux-gnu/libc.so.6

$ objdump -s -j .gnu_debuglink -j .note.gnu.build-id
/lib/x86_64-linux-gnu/libc-2.27.so

Contents of section .gnu_debuglink:
0000 6c696263 2d322e32 372e736f 00000000 libc-2.27.so....
0010 5ac51387 Z...
Contents of section .note.gnu.build-id:
0270 04000000 14000000 03000000 474e5500 ............GNU.
0280 ce450eb0 1a5e5acc 7ce7b8c2 633b02cc .E...^Z.|...c;..
0290 1093339e ..3.

So elf_find_debugfile_by_debuglink("libc") loops back to
/lib/x86_64-linux-gnu/libc-2.27.so and can't lookup symbols for libc and
another standard libs. This patch breaks this loop and allows to lookup
for symbols at other places.

@googlebot
Copy link
Collaborator

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added the cla: no CLA not signed label Mar 3, 2021
@pavel-orekhov
Copy link
Author

@googlebot I signed it!

@googlebot
Copy link
Collaborator

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

Some distribs like ubuntu'18 creatively name files with debug symbols.
(same name without .debug suffix). And give no `build-id` way.

$dpkg -L libc6-dbg | grep -v gconv
/usr/lib/debug/.build-id/68/f36706eb2e6eee4046c4fdca2a19540b2f6113.debug
/usr/lib/debug/lib/x86_64-linux-gnu/libc-2.27.so

$ dpkg -L libc6
/lib/x86_64-linux-gnu/libc-2.27.so
/lib/x86_64-linux-gnu/libc.so.6

$ objdump -s -j .gnu_debuglink -j .note.gnu.build-id \
  /lib/x86_64-linux-gnu/libc-2.27.so

Contents of section .gnu_debuglink:
 0000 6c696263 2d322e32 372e736f 00000000  libc-2.27.so....
 0010 5ac51387                             Z...
Contents of section .note.gnu.build-id:
 0270 04000000 14000000 03000000 474e5500  ............GNU.
 0280 ce450eb0 1a5e5acc 7ce7b8c2 633b02cc  .E...^Z.|...c;..
 0290 1093339e                             ..3.

So elf_find_debugfile_by_debuglink("libc") loops back to
/lib/x86_64-linux-gnu/libc-2.27.so and can't lookup symbols for libc and
another standard libs. This patch breaks this loop and allows to lookup
for symbols at other places.
@googlebot
Copy link
Collaborator

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes CLA signed and removed cla: no CLA not signed labels Mar 3, 2021
@pavel-orekhov
Copy link
Author

FYA @ianlancetaylor

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

Successfully merging this pull request may close these issues.

2 participants