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

Demonstrate how ELF extraction/utilities can be done using SQL #458

Closed
wants to merge 10 commits into from

Conversation

fzakaria
Copy link

@fzakaria fzakaria commented Sep 27, 2023

I'm working on sqlelf which is a tool that lets you explore ELF files using SQL.

What's really interesting and neat about this tool is that it lets you declaratively write what data you are interested in without knowing the internals of the ELF file format or working with the the necessary ELF parsing library.

The snippets are also very easily runnable outside the codebase which makes validating the tests separately super easy.

Here is a current draft where I have replaced a good number of the functions with their respective SQL equivalent.
I'm interested in feedback or thoughts on the approach.

We can get quite fancy with the SQL to even split the strings of RUNPATH for instance for instance.
image

fzakaria and others added 5 commits September 25, 2023 18:04
Introduce the sqlelf to auditwheel.
The goal of sqlelf is to make it more easy to declaratively find/get
information from an ELF file using SQL

* replaced find_symbol_versions
* removed dead code
* removed unecessary tests
@fzakaria fzakaria marked this pull request as ready for review September 27, 2023 17:05
fzakaria and others added 5 commits September 27, 2023 17:25
Changed the code to read rpath/runpath to just return true/false whether
they exist which is how the function is being used.

Changed the implementation to use sqlelf SQL query instead of
pyelftools.
@lkollar
Copy link
Contributor

lkollar commented Nov 20, 2023

This looks like a cool project.

What's really interesting and neat about this tool is that it lets you declaratively write what data you are interested in without knowing the internals of the ELF file format or working with the the necessary ELF parsing library.

While this sounds nice, I think users still need to have some knowledge of ELF to be able to use sqlelf, and anyone contributing to auditwheel's parts dealing with ELF will need to have a good understanding of the format anyway.

My main concern with this is that it would require developers to have fairly good SQL knowledge to contribute to the code base. While the equivalent Python code is often more verbose, I expect that anyone who's able to contribute to auditwheel will be able to fairly easily understand it, but this might not be the case with SQL code, which is a new language in this code base. And besides, mixing SQL with Python code means tools like linters, IDEs, etc. won't be able to help catch bugs, offer autocomplete, etc.

So all in all, I'm not convinced that replacing pyelftools with sqlelf provides enough benefits to be worth doing.

@mayeut
Copy link
Member

mayeut commented Feb 3, 2024

Thanks for your interest in the project @fzakaria
While indeed it looks like a cool project, I do agree with @lkollar w.r.t to the inclusion in auditwheel for the reasons he stated.

@mayeut mayeut closed this Feb 3, 2024
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 this pull request may close these issues.

3 participants