Page 1 of 2

Best way to patch exeDSP?

Posted: Tue Dec 22, 2015 12:45 pm
by Neoplane
Hello everyone,

Since some months our C series don't work with latest Plex Media Server (and PlexForSamsung App) and found that the problem is in the Samsung player itself, that seems to don't be developed according to HLS protocol. Original plex thread: http://forums.plex.tv/discussion/176169 ... er-problem.

I've found out how to patch exeDSP in order to solve that problem (thanks sectroyer for all the info about debugging on C series!). I know which memory address should I overwrite and what should I write in (just a NOP in the end), thus right now using a "set" in gdb I've fixed the problem.

My question is about which is the safest way to deploy this fix. In the end I just need to overwrite exeDSP, being able to rollback the change if something goes wrong.

Many thanks!!!

Re: Best way to patch exeDSP?

Posted: Tue Dec 22, 2015 1:24 pm
by sectroyer
The safest way is to write lib which dynamically finds correct place to patch and use samyGOso to load it. When you use such approach you share the libs with others. BTW what does your patch "do" ?:)

Re: Best way to patch exeDSP?

Posted: Thu Dec 24, 2015 12:25 am
by Neoplane
I'll take a look in other patches then to get an example :)

Found that, when player is reproducing a m3u8 playlist and it includes an ext3 tag that is not in the list of recognized tags by the player, it is stopping. In HLS protocol is specified that when an unrecognized tag is found, player should ignore it.

New plex media server is including one new tag in their playlist when transcoding, thus player is always stopping under this circunstances.

Fix is plain easy, change a branch for a nop. Anyway, plex developers are developing a fix on plex server thus my patch may not be needed. But as I've already made the ivestigation, I'll create and distribute the patch asap.

Thanks!!

Re: Best way to patch exeDSP?

Posted: Thu Dec 24, 2015 10:21 am
by sectroyer
Sure. Share with us. At the same time you will learn a lot :)

Re: Best way to patch exeDSP?

Posted: Fri Dec 25, 2015 11:56 am
by tempinbox
Neoplane wrote:I'll take a look in other patches then to get an example :)

Found that, when player is reproducing a m3u8 playlist and it includes an ext3 tag that is not in the list of recognized tags by the player, it is stopping. In HLS protocol is specified that when an unrecognized tag is found, player should ignore it.

New plex media server is including one new tag in their playlist when transcoding, thus player is always stopping under this circunstances.

Fix is plain easy, change a branch for a nop. Anyway, plex developers are developing a fix on plex server thus my patch may not be needed. But as I've already made the ivestigation, I'll create and distribute the patch asap.

Thanks!!
if you need a tester i'm here. ;)

Re: Best way to patch exeDSP?

Posted: Tue Jan 12, 2016 12:56 am
by Neoplane
Thanks tempinbox! I'll send it to you asap :)

Just after holidays I started to create the patch, but I'm having some trouble...

find_func_by_string is not finding the symbol I need. The symbol (and patch point) it's not itself on exeDSP but on libahas.so. I'm using utils taken from NoDRMPatch, but it seems that it's not getting the symtable for linked libraries. I know everything it's working because I'm able to read all the symbols from exeDSP when executing the patch, and I get the symbols using libahas instead of exeDSP, I'm able to retrieve the memory offset, but it's not the correct one (as it's not the loaded in memory).

Which may be the best approach to find my starting point to patch? Should I use another patch as example? This one seemed fairly easy to understand... :)

One idea that I have is to get symbol offset directly from library, then retrieve at which mem offset the library is currently loaded (cat /proc/pid/maps | grep libahas), and start moving from that point...

As you may see, I'm totally new to this :)

Thanks!!

Re: Best way to patch exeDSP?

Posted: Tue Jan 12, 2016 9:52 pm
by sectroyer
if symbol is exported simply use dlopen/dlsym :) find_func_by_string is for NOT exported symbols that are NOT in symtable :)

Re: Best way to patch exeDSP?

Posted: Fri Feb 12, 2016 10:57 pm
by Neoplane
Hello sectroyer,

I'm still having some problems creating the patch...

If I try to dlopen the library (libahas.so) I get an undefined symbol error (_ZN7CCDebug5ResetEv) thus I cannot dlsym to get a starting point to find right place to patch... I think that this symbol is found in the same exeDSP, and I'm correctly attached (using ptrace) to exeDSP process, as I can patch if I set the mem address manually...

How can I deal with this?

Many thanks :)

Re: Best way to patch exeDSP?

Posted: Sat Feb 13, 2016 9:30 am
by sectroyer
dlopen fails ? dlopen should NOT fail. Also _ZN7CCDebug.... is NOT libahas.so symbol :)

Re: Best way to patch exeDSP?

Posted: Sat Feb 13, 2016 6:50 pm
by Neoplane
I'm getting a NULL as return of dlopen, and I'm getting this message as return of dlerror:
/mtd_exe/Comp_LIB/libahas.so: undefined symbol: _ZN7CCDebug5ResetEv

This symbol I think that it's found in exe_DSP itself, I can find it in "C_exports.txt file that you attached in the thread about how to debug in C series.

What may be my problem then?

Many thanks for your help! :)