{{ message }}
Repository navigation
Conversation
Member
elicn
reviewed
Feb 19, 2025
| # start area memory for API hooking | ||
| # we will reserve 0x1000 bytes for this (which contains multiple slots of 4/8 bytes, each for one api) | ||
| API_HOOK_MEM = 0x1000000 | ||
| API_HOOK_MEM = 0x2000000 |
elicn
requested changes
Feb 19, 2025
| self.ql.mem.map(stack_address, stack_size, info='[stack]') | ||
|
|
||
| # Setup heap | ||
| self.ql.os.heap = QlMemoryHeap(self.ql, 0x3000000, 0x3000000 + 0x1000000) |
Member
There was a problem hiding this comment.
Heap base and size should be set based on the value configured in the profile file. Using hardcoded values is not a good idea.
| # is it a driver? | ||
| if elftype == 'ET_REL': | ||
| self.load_driver(elffile, stack_address + stack_size, loadbase=0x8000000) | ||
| self.load_driver(elffile, stack_address + stack_size, loadbase=0x1000000) |
Member
There was a problem hiding this comment.
Any reason for this change here?
Keep in mind this module serves all ELF files on all architectures, not only ARM.
| _sym = _symtab.get_symbol_by_name(name) | ||
|
|
||
| # Cache | ||
| if self._symbol_name_map == None: |
Member
There was a problem hiding this comment.
This could be simplified with an internal function decorated with @cache (available from Python 3.9) or @lru_cache (available earlier).
from functools import cache
@cache
def __get_cached_symbol(name: str) -> int:
# access symtab symbol here and return the result
...Also, I am not sure that _symbol_name_map should be assigned to self, but stay local.
Member
There was a problem hiding this comment.
I think function calls are automatically unwinded.
Have you checked this is?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Checklist
Which kind of PR do you create?
Coding convention?
Extra tests?
Changelog?
Target branch?
One last thing
These fixes add support for emulating a ARM kernel object by implementing
R_ARM_CALLandR_ARM_JUMP24. Additionally, the__get_symbolfunction now has caching in order to speed up loading ARM kernel objects as elftoolsget_symbol_by_namefunction is slow when iterating each time.