Relocate import symbol addresses for loaded PE files#886
Conversation
|
Cool, once we finish the test I will merge this PR. again, welcome to the community! |
|
seems like there is a missing dll you might want to edit this in your PR and make sure it copy the dll https://github.com/qilingframework/qiling/blob/dev/examples/scripts/dllscollector.bat |
71e6272 to
46e3402
Compare
|
Thanks for the warm welcome! I don't really have a good way of testing on windows right now, but I think I've added correctly the missing dlls. Its interesting, I'm using system dlls from Win7, and the system dlls import symbols from that missing lib, but they are all bound. So that missing lib never actually gets loaded. I guess on the newer version of windows that the tests are run on, those system dlls have some unbound import symbols. |
|
We will find out in the test. CI test acts funny sometimes. So, only CI knows what CI wansts. |
|
seems like a rejection from CI https://github.com/qilingframework/qiling/pull/886/checks?check_run_id=3337741032 |
46e3402 to
1df8774
Compare
|
Looks like I'm going to have to keep playing this game until it stops complaining. Here's another round |
|
ping. Can I get the workflow run again, until we can get all the needed libraries added? |
|
every code will be tested automatically |
1df8774 to
15aa189
Compare
|
@xwings The workflow does not run automatically after I do a push. It always tells me I forgot I needed to take into account x86 vs x8664 rootfs, so prior changes may have been wrong. This may mean a couple extra cycles. Please approve the workflow again. |
|
Its also annoying that I can't got back and look at prior runs of the workflow. Once the PR branch is updated the workflow CI output is removed. |
|
lets checkout the test :) |
4a26a73 to
33872bc
Compare
|
still fail :( |
Before only the imported symbols of the main PE file were relocated. This mostly worked because the common Windows dlls (eg. kernel32.dll and user32.dll) normally have imported symbols which are already bound, and thus do not need relocating.
33872bc to
ee69754
Compare
|
It looks like one snag, is that there is no I need to read up it more, the loader might need to be updated to support this. I don't know why some of the API sets exists and some don't. |
Currently only the imported symbols of the main PE file are relocated. This
mostly works because the common Windows dlls (eg. kernel32.dll and
user32.dll) normally have imported symbols which are already bound, and
thus do not need relocating. However, if a library loaded at runtime (believe at
loadtime also) has unbound import symbols, they will need to be relocated.
I have run the tests and they all succeed, but I have not added any new ones.
The binary that I'm analyzing that triggers this is 38Mb (kinda large), but it could
probably be truncated to 5Mb and still be effective as a test.
This is partly a refactor in that a code chunk is moved into
qiling.loader.pe.Process.init_imports.The moved code maintains mostly the same behavior with some notable differences.
load_dllonce.KeyErrorwhen adding the symbol toimport_address_tablethe loop iscontinued,which was a minor bug in the current code
Checklist
Which kind of PR do you create?
Coding convention?
Extra tests?
Changelog?
Target branch?
One last thing