-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Better way to determine the glibc version #22516
Conversation
Funny that after years of stale code two people are working on the same thing, I also did some new libc version detection in koyaan@ffcb7c2
|
Yeah... you're version seems solid. I also made a change to |
libr/core/cmd_debug.inc.c
Outdated
|
||
// We only care about the first match | ||
char *first_match = r_list_first (matches); | ||
version = r_num_get_float (core->num, first_match); |
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 think this api should be renamed to get_double instead 🤔
unum.c:R_API double r_num_get_float(RNum *num, const char *str) {
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 can make this change, but I'd rather do it in a separate 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.
Yes please
r_io_bind (io, &bin->iob); | ||
RBinFileOptions opt = { 0 }; | ||
|
||
if (r_bin_open (bin, libc_path, &opt)) { |
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.
maybe worth adding some extra checks about the filetype. but guess its fine for an intiaial approach.
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.
Checks such as what? Like making sure it's an .so?
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.
Not sure if its worth ensuring its an elf too. But i doubt this function will take a wrong path as arg
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.
lgtm
* New function get_glibc_version that gets strings from the glibc .so and parses out the version. * Unit test at `test_glibc_version.c`
Should i close this pr? |
Please leave it open till mine is resolved i will take some code from this |
Closing this pr in favour of the other one |
Description
So I wrote a new function that determines the glibc version based on the strings inside the .so.
This is similar to what pwndbg/GEF do. Previously, the version was parsed out of the filename, but this is not
relevant for newer versions of libc as they will all be named
libc.so.6