Page 2 of 8

Re: Injecting modules into exeDSP

Posted: Sat Oct 09, 2010 2:23 pm
by flo-ogb
tusko wrote:Good idea !! I know that this is not general enough, but the following modification does that. It works on my TV, and after the imports cache file is created, it is fast !!
Could you please post the compiled binary (preferably the CI+ version)? I don't have the toolchain ready...

I'm think this is a very useful optimisation, my TV currently takes a minute to init all extensions, even authuld finishes faster :roll:

Re: Injecting modules into exeDSP

Posted: Sun Oct 10, 2010 7:17 pm
by nostromo1983
I've juste tested the injector with sample module and here is what i have, after 1min 30s of waiting:

Code: Select all

# ./injectso `pidof exeDSP` module.so Inject_Main /dtv/

Module injector V1.1 for ARM based CPUs.
(copyleft) SmartSmurf 2010 (smartsmurf@shared-files.de)


Info: value of linker map is 0x12078
Info: Import 'dlopen' found at 0x004a7878
Info: Import 'dlsym' found at 0x004a6e70
Info: Import 'dlclose' found at 0x004a6924
Info: current register set:
R0 =0xFFFFFFFC R1 =0x00000000 R2 =0x00000001 R3 =0x00000000
R4 =0x00000001 R5 =0x025EA250 R6 =0x020EC358 R7 =0x000000F0
R8 =0x00000000 R9 =0x00000000 R10=0xBEB23A78 R11=0x00000000
R12=0x00000001 SP =0xBEB23A68 LR =0x4005DA44 PC =0x4005B008
CPSR=0x80000010

Info: new SP for inject code 0xBEB23668
Done.
#
Is the the desired output, and why it takes 1min30s for this?

Re: Injecting modules into exeDSP

Posted: Mon Oct 11, 2010 10:06 am
by smartsmurf
tusko wrote:nostromo1983: It is slow because to find the dl* functions long loops of ptrace syscalls are used.

flo-ogb: Sorry, right now I do not have access to my toolchain either but I will have access in a few days, if that it is ok to you ... By the way, my TV is not CI+ but I think there should not be any differences.
You are right. The ptrace syscalls slow it down.
I updated the first post of this thread with a new version, which caches the imports. It is requires the path "/mtd_rwarea/etc" where it stores a file named "injectso.imports". For future improvements I would generate an import file for each binary which gets code injected, e.g. "/mtd_rwarea/etc/importso.d/mtd_exe/exeDSP.imports".

Re: Injecting modules into exeDSP

Posted: Mon Oct 11, 2010 1:57 pm
by flo-ogb
wow, tanks guys! that works really beautiful! :) :)

swapping the binary with the new one makes the startup MUCH faster. from 1:49 minutes spent in samygo.sh before to now just 17 seconds! and i could easily shave of some more seconds, if i remove some sleeps...


EDIT: now at 11 seconds. big thumbs up!