-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
libcdb: improve the search speed of search_by_symbol_offsets
#2413
Conversation
I think we can avoid walking the local database directory again here in the first place instead. When finding a match in the local libc-database, we know the id and thus the filename of the libc we want to return. Maybe allow the |
I agree that handling |
I'm not sure I like |
Sorry too late. I added a #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from pwn import *
context.log_level = "info"
context.local_libcdb = "/root/S3cur1ty/libc-database"
log.waitfor("searching build_id")
os.system("rm -rf ~/.cache/.pwntools-cache-*")
time_start = time.time()
path = libcdb.search_by_build_id("6ee9454b96efa9e343f9e8105f2fa4529265ea05", offline_only=True, unstrip=False)
libc = ELF(path, checksec=False)
print(f"cost {time.time() - time_start}s", libc) |
CHANGELOG.md
Outdated
@@ -83,6 +83,7 @@ The table below shows which release corresponds to each branch, and what date th | |||
- [#2376][2376] Return buffered data on first EOF in tube.readline() | |||
- [#2387][2387] Convert apport_corefile() output from bytes-like object to string | |||
- [#2388][2388] libcdb: add `offline_only` to `search_by_symbol_offsets` | |||
- [#2413][2413] libcdb: improve the search speed of `search_by_symbol_offsets` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rebase on latest dev please and move this to the 4.15.0 changelog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how to rebase just the CHANGELOG.md
. Do I need open a new PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your persistence while implementing this! I've finally had a minute to look at the current state again and I think it's good minus a few nits. I can fix those myself too if you're busy.
I’ve addressed the nits you mentioned and have completed the modifications. I hope we can merge this soon so I can move forward with the libcdb-cli changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thank you!
While using
search_by_symbol_offsets
, I found that the search speed forbuild_id
was significantly slower compared to other hash types.The reason for this is that ELF loads too many things. I attempted to replace it with
ELFFile
, which noticeably improved the speed, but it introduced redundant functionality. I couldn't think of a simple way to implement it, so I added ahash_type
parameter tosearch_by_symbol_offsets
, with a default setting ofmd5
to speed upsearch_by_symbol_offsets
, and provide users with a controllable option.I'm testing on the following code:
and found another question #2414