-
Notifications
You must be signed in to change notification settings - Fork 26
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
open up libkfio.o #82
Comments
Nice! I have part of it deconstructed, which I should probably check in into github. There's also parts that are not easy to deconstruct, as there are some anonymous functions, seems like these are only called from the code in the library. |
Good idea. Here are the efforts so far (at least what I was able to duplicate) https://www.codepile.net/pile/V8gwD784 |
More than that cannot be taken over without problems. Thats why I'm currently playing around with objedump symbol renaming :) |
@plappermaul make your life easy, use Ghidra. you can choose to load the entire module in or the .so. It will decompile it and make reasonable nice C code for you ;) (that's what I did, I can't upload it now, but could do later). The C code looks very usable! |
Thanks for the info. Mostly I cared about the structures that are still hidden inside the lob. So I looked at the functions to give this meaningful names. I have several symbols in the lob renamed and globalized (at least in the cc73 file. Should I send a new version in? |
@plappermaul yep please send it in if it works and makes things clearer that is definitely a good thing! The cc74 is a copy of cc63, which is the last OG compiled .so delivered with the driver. During make we just copy the last .so to the next based on the gcc version. I've created a libkfiio branch and uploaded the .c and .h file there. It's a whopping 4.2MB, I think a bunch of stuff got decompiled in a not so good way (strings/errors and some of the graph/path handling). I think it'd be good if we can split out the external interface bits first perhaps, and then move to unravel the remains? The external interface bits should be easy to clean also I think as they're known from our side. I also have a list of what the .so imports from the source driver as part of the symbol tree, not that that is incredibly interesting, but may be useful? I'm still figuring out how to save it though. Don't hesitate to join the Discord ;) |
pushed a commit with some initial renames. Can you have a look if everything sitll compiles nicely? |
Thanks! I changed Test suite is running now :) This was the error btw:
|
@snuf : Do me a favour and update the disassembly |
@plappermaul done, shows nice functions now, I left the cc93 in (which is a copy of the original) and did the cc74 decompile. |
I just tried to add a new c library to the project but I'm missing the hook to integrate it. What do I have to do to get it compiled? |
found it ... KBuild file |
Haha, I hadn't noticed but the pci_probe you introduced and the device opening fix the enumeration of the device. Before having two devices,
The test scripts use an expression that just matches on Nice! |
Thanks for the positive feedback. Nevertheless I will fix the increment rc = iodrive_pci_attach(pci_dev, gv_init_pci_counter++); |
That's fairly amazing actually. Does this bring us closer to unifying the
codebase?
…On Wed, May 5, 2021 at 10:26 AM Funs Kessen ***@***.***> wrote:
Haha, I hadn't noticed but the pci_probe you introduced and the device
opening fix the enumeration of the device. Before having two devices, vsl
and vsl4, the driver would conflict on the fct and fioX. After manually
loading the driver on the test box I noticed this:
[ 107.648552] <6>fioinf ioDrive 0000:00:04.0: Found device fct1 (Fusion-io ioDrive2 1.205TB 0000:00:04.0) on pipeline 0
[ 109.403206] <6>fioinf Fusion-io ioDrive2 1.205TB 0000:00:04.0: probed fct1
[ 109.483578] <6>fioinf Fusion-io ioDrive2 1.205TB 0000:00:04.0: sector_size=512
[ 109.483581] <6>fioinf Fusion-io ioDrive2 1.205TB 0000:00:04.0: setting channel range data to [2 .. 2047]
[ 109.814983] <6>fioinf Fusion-io ioDrive2 1.205TB 0000:00:04.0: Found metadata in EBs 245-245, loading...
[ 110.161428] <6>fioinf Fusion-io ioDrive2 1.205TB 0000:00:04.0: setting recovered append point 245+749518848
[ 110.169701] <6>fioinf Fusion-io ioDrive2 1.205TB 0000:00:04.0: Creating device of size 1205000000000 bytes with 2353515625 sectors of 512 bytes (515361258 mapped).
[ 110.177427] fioinf Fusion-io ioDrive2 1.205TB 0000:00:04.0: Creating block device fiob: major: 251 minor: 16 sector size: 512...
[ 110.177891] fiob: fiob1
[ 110.178444] <6>fioinf Fusion-io ioDrive2 1.205TB 0000:00:04.0: Attach succeeded.
The test scripts use an expression that just matches on fio when looking
so I never noticed. This could mean that we can have the drivers side by
side in one machine, as long as vsl4 loads first :)
Nice!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#82 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AO7IG5DPATZD6RMJGHN34MLTMFIQXANCNFSM43RSY22Q>
.
|
@Tourman36 yes and no, it brings us closer, but there is a lot more work to be done before that would be the case. |
@snuf I recovered some of the function names in the blob. Maybe you can merge them into master. Best would be to integrate them into the build scripts so we always have a readable library version at hand. |
@plappermaul sorry for the delay here, I’ll do a test run of the code and
we can merge it into master after. What build script integration requires
doing? I can take a look at that if you point me somewhere :)
…On Sun, May 23, 2021 at 11:42 PM plappermaul ***@***.***> wrote:
@snuf <https://github.com/snuf> I recovered some of the function names in
the blob. Maybe you can merge them into master. Best would be to integrate
them into the build scripts so we always have a readable library version at
hand.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#82 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABSGBABDXBHNRPJ67YZN4MDTPHYO3ANCNFSM43RSY22Q>
.
|
No need to hurry. We have basically two choices: Either replace all the symbol names in the libraries once. Keep the modified libraries from then on Or keep the libraries as is and keep a script that switches the symbol names on demand. Maybe dynamically in the build process. Choose whatever you like. |
This is what we need to do for each symbol. objcopy --redefine-sym ifio_58422......fef60.3.2.16.1731=fio_device_get_write_retard_reason x86_64_cc53_libkfio.o_converted |
Wrote some shell to do this full rename in one go based on the file provided, though the time it takes to do the obj replacement I think it would be better to do the updates to the file and check it in, instead of doing it compile time. The compile of the driver is faster than the obj renaming now, by a lot. We can incrementally update the |
Good idea. As the sha1 symbol names are used nowhere else feel free to permamently decode them. |
Sorry for the delay on that I had to look back at where we were with that. I have a script that does the translation however if I do it on the "vanilla" module, not the one that's bundled in the libkfio branch, I get some errors on objects that are undefined. Could it be there are some missing from the translation table you've renamed before, and if so are you able to add those to the hashes file?
I forgot if I ran tests with it, am doing that now, and if all is good I'll commit the script in the libkfio branch for "posterity". The thing however is that right now I've setup the make script to do a pass every time it's run, thought I think that is a bad idea in hindsight and we should just commit the patched binary (as it saves a lot of time when building/renaming/etc). What are your thoughts on this? |
All looks good btw, so PR and merge it I would say! :) (or you want me to do it?) |
As long as you simply replace the decoded symbols and do not take any other of my crap from this branch. Feel free. I'm currently busy on other projects. Thanks. |
After digging around in the driver I think it might be possible to open up the precompiled libkfio.o. That would require some code rearrangement. If you think that is worth a try ... here are some first bits:
The text was updated successfully, but these errors were encountered: