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

Remove verification of the non st_value for import function. #968

Closed

Conversation

Mrbenoit624
Copy link

mips and powerpc add a st_value for their import function (issue #796). So we need to remove this verification to let not to hide some import functions

mips and powerpc add a st_value for their import function (issue lief-project#796)
@@ -214,8 +214,9 @@ bool Symbol::is_imported() const {
// An import must not be defined in a section
bool is_imported = shndx() == static_cast<uint16_t>(SYMBOL_SECTION_INDEX::SHN_UNDEF);

// An import must not have an address
is_imported = is_imported && value() == 0;
// An import must not have an address but mips and powerpc put an addres for
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you have an example/sample for this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes of course, https://transfer.ci-yow.com/d?id=RcdhAdQ3vsAuWeX, this is one the function imported "strstr" which have an st_value.

I have some better example if you want but I can't share you here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No thanks it's a good sample.
I see the issue, my only concern is that your change drop the condition for all the architectures, not only MIPS/PPC.
On the other hand, the targeted architecture is not accessible from the Symbol class.
I need to think about how we can fix this design issue.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am agree, I would like to limited this drop this check only for these two architectures but as you said, I didn't find how to do it without a big refactorisation of you code...

But when I check how some technique to identify imported function, and how the loader do, it should look symbols and resolve undefined symbols. So the main meaning check should be:

  bool is_imported = shndx() == static_cast<uint16_t>(SYMBOL_SECTION_INDEX::SHN_UNDEF);

the others is for safety but they should not add bug.

I let you see what you prefer and if you would like to do a big factorisation to get access of ARCH by symbols, I could help you to dev :).

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

Successfully merging this pull request may close these issues.

None yet

2 participants