yashsingh1/xdaforums huggingface dataset:
[Sony Cross-Device General] DHGE:
Both versions could carry a virus -> send the zip/rar files to virustotal.com and muse over the results

You have to put trust in [MENTION=4120742]munjeni[/MENTION]

Or monitor the executables, run them as unprivileged user or in a VM-snapshot ...

What lands on your device is modifications of the init-scripts:

you can look at the results with a text editor.

Writing a generic arm virus and delivering the payload via the poc scripts is not easy and - not doing homework very intensively - I do not sweat using the scripts.
[Sony Cross-Device General] Cerhio:
Huh, so I guess is this method obsolete without OP?
[Sony Cross-Device General] DHGE:
I hope that they unblock him again.

Sometimes I also get carried away by some lazy, lame noobs and had a thread cleaned where I vented against an idiotic post (showing not even basic thinking/effort) ...

[MENTION=4120742]munjeni[/MENTION] has done much more for xda-community than I could time/knowledge wise.
[Sony Cross-Device General] oziris11:
For what bought - for that sold.

I find it easier to remove the post.

P.S. To the previous archive for some reason had no complaints.
[Sony Cross-Device General] mbc07:
For anyone trying to get Magisk working with ta_poc, I discovered the possible cause and it's related to Sony RIC. At least on Xperia X, the actual code to disable Sony RIC by writing 0 to /sys/kernel/security/sony_ric/enable runs only after triggering on boot hook, which runs after on post-fs-data hook. Magisk service gets initialized on post-fs-data, thus, before triggering on boot, so, RIC is still active when Magisk tries to start its service even if you disabled Sony RIC service in ta_poc or Root Kernel and so, Magisk get permission denied when trying to mount its stuff and it ends not working (you can check those access denied messages by looking at /cache/magisk.log).

On one of my attempts, I've applied the RIC Disabler patch directly on init.magisk.rc, right before it loads its service, and that "fix" worked on Nougat 7.0 firmware (got ta_poc and Magisk working fine), but on 7.1.1 the device reboots somewhere after on post-fs-data hook is triggered (haven't been able to debug that reliably). Another attempt I did was simply purging Sony RIC service and any reference to it from all init*.rc files so it never gets loaded, but somehow it still denied Magisk from mounting its stuff at boot. The only way I got Magisk working was by disabling Sony RIC in on post-fs-data hook instead of on boot hook which is normally where it gets configured, but doing that makes the phone reboot soon after (at least that's the case on my Xperia X running Android 7.1.1).

On a side note, you guys probably noticed that Root Kernel patched kernels works fine with Magisk, and I isolated this to add_vendor_overlay function from rootkernel.sh, you don't even need to apply the DRM fix as long as add_vendor_overlay function gets called when processing the kernel image, and it also does exactly what I tried, disabling Sony RIC on post-fs-data instead of on boot, but somehow it doesn't make the device reboot when processed by Root Kernel, as it normally does if I patch the RAM Disk manually. Maybe I'm missing a SELinux permission somewhere, could someone help me debugging what is causing this?
[Sony Cross-Device General] juanpirulo:
its suposse its working allready with the last magisk updated. I have no problem with poc and magisk, everything fine. cheers
[Sony Cross-Device General] mbc07:
That's not the case with any of the Xperia X stock firmwares (tried on all of them 6.0.1/7.0/7.1.1). Flashing Magisk v13.3 on top of a ta_poc generated boot image or directly flashing Magisk on top of the stock kernel doesn't work (Magisk Manager says it's not installed and /cache/magisk.log show permission denied errors), but it works if you use the DRM Fix from Root Kernel. I isolated that to Sony RIC still being active when Magisk services get initialized, and somehow applying the old DRM Fix with Root Kernel fixes that...
[Sony Cross-Device General] pjohn23:
Xperia Z

I have a C6603 phone UB and with RR custom rom, can i use this? and how? can anyone guide me?
[Sony Cross-Device General] PhonerX:
I have exactly the same problem with XZ and latest version of Magisk.
[Sony Cross-Device General] j1tters:
Am I missing something obvious here? Came looking for the ta_proc.rar file from this guide, https://xdaforums.com/x-compact/how-to/guide-root-custom-kernel-clean-rom-ta-x-t3583183, and either it's not here or I'm completely missing it. Am I blind?
[Sony Cross-Device General] RaXelliX:
You're not blind. Since OP's account is currently closed the attachments are not available for download. Please see last pages. There's a user uploaded version of ta-poc. I also uploaded it but it's an older version.
[Sony Cross-Device General] j1tters:
Thanks. I figured it was in a user post but I started from the beginning...
[Sony Cross-Device General] munjeni:
New version is out, hope this -> https://xdaforums.com/showpost.php?p=73232574&postcount=1547 isue solved. I am back and just to tell you about reason for post removal... done that because all executables was UPX packed by me but every UPX version curently which I found on internet is reported as a malware on virustotal! I have no idea why virustotal reports upx as a malware but if you not believe me just download any version of the upx, submit it to the virustotal you will notice the same malware, I realy don't know if that malware is false or true but better idea is omiting upx packer, curently I going to recompile all my tools and not use upx anymore. Enjoy!
[Sony Cross-Device General] fluffi444:
Thanks goodness you are back! :good:

For me it doesn't count what happend - Actually I didn't know it in particular - But I know what you did for the SONY community - Lots of great tools!

And that's enough to know... :highfive:

Forget about the un-experienced user who are blaming others because of their lack of knowledge.
[Sony Cross-Device General] RaXelliX:
Welcome back.
[Sony Cross-Device General] zohaib0001:
Welcome back

Good to see you again :)
[Sony Cross-Device General] kuntiiiL:
\m/ yeahhh \m/

our XDA Warrior is back!

unbelievable, thought it was forever, thank you to moderators. . .
[Sony Cross-Device General] munjeni:
Thanks guys! Does new version solve magisk isue?
[Sony Cross-Device General] Klaus N.:
Your return is really appreciated!

I'll test the new PoC version with Magisk on my father's Z5 tomorrow and report back :good:
[Sony Cross-Device General] fluffi444:
I would be happy to try and test but I don't use Magisk at all.... Still happy with old suhide and rootswitch configuration.

Never touch a running system ?
[Sony Cross-Device General] Klaus N.:
[MENTION=4120742]munjeni[/MENTION]

So, I can confirm: I've repacked the boot.img with the new PoC-version (current .160 fw for the E6653), and Magisk works :good:
[Sony Cross-Device General] DuskGolem:
[MENTION=4120742]munjeni[/MENTION], bro it is not working for me on Xperia Z5 Premium E6833. I used TA.img and kernel.sin as it is without changing anything in DOUBLECLICKME.bat.

[MENTION=4898998]Klaus N.[/MENTION], bro can you tell me the configuration you used on the stock kernel? I used "sony RIC OFF, dm-verity disabled, TA install". :confused:

Problem is, I can successfully modify the kernel.sin with the tool and also successfully install the magisk 13.3 but after this my phone keeps restarting on the sony logo.

Please guys help me out......:crying:
[Sony Cross-Device General] Klaus N.:
I don't know, as you've got the Premium device. But I would suggest to extract the kernel (kernel.sin or kernelX.sin) out of the ftf first. Then make a kernel.elf out of it with the awesome tool [MENTION=1879618]IgorEisberg[/MENTION] (simply drag and drop the sin file onto UnSIN.exe). Now put the resulting kernel.elf - together with your TA.img - inside the root folder of PoC, afterwards simply start the tool by a double click on <DOUBLECLICKME.bat> and choose your kernel.elf and your TA.img. At last flash the result (new_boot.img) via fastboot, reboot the device, boot into recovery, flash Magisk again, reboot, and you're done!
[Sony Cross-Device General] DuskGolem:
[MENTION=4898998]Klaus N.[/MENTION], I followed all your steps, still not working on E6833 on latest 7.1.1. Please refer to the logs attached.
[Sony Cross-Device General] munjeni:
Thanks mate! No need to unsin since poc have builtin unsin (this one https://xdaforums.com/crossdevice-dev/sony/tool-unpack-format-sony-kernel-image-t3530077) which doing the same thing like Igor unsin tool!
[Sony Cross-Device General] munjeni:
I will heck your logs when I get with pc, not with pc now. Can you post original kernel?
[Sony Cross-Device General] DuskGolem:
[MENTION=4120742]munjeni[/MENTION], guess I should wait then?
[Sony Cross-Device General] munjeni:
I will check tommorow! Can you upload original kernel?
[Sony Cross-Device General] munjeni:
checked your log but thats dmesg from recovery so that can't help, I need kernel crash log (last_kmsg), can't help you with that since I have old xperia, newer phones have last_kmsg name and path changed, please ask somebody to give you info about how you can dump that log!
[Sony Cross-Device General] DuskGolem:
[MENTION=4120742]munjeni[/MENTION], OK I will try to upload the crash log and stock kernel...
[Sony Cross-Device General] DuskGolem:
[MENTION=4120742]munjeni[/MENTION], here is the stock kernel.elf (unmodified completely stock) you asked for. As for the kmsg log, i haven't had any luck collecting it.

P.S: i used the following configuration on stock kernel when i flashed. The modified kernel itself works flawlessly after flash. Problem occurs when i install magisk (tried both v13.3 and v13.6 beta) onto the modified kernel. The phone shows sony splash screen and then keeps rebooting..

-Dm-verity disabled

-Sony RIC disabled

-Forceencrypt was already disabled

-Recovery NOT INCLUDED (as magisk would not install if recovery is merged into the kernel)

-TA.img included....
[Sony Cross-Device General] munjeni:
Tried to patch your kernel, its flashed sucesfully without any problem. I can't help you without kernel crash log! :( Anybody contacted developer of the magisk about problem? I'm believing problem ocours with stock kernel too when magisk gets installed, so I can't call it PoC problem. Probably I can add support for magisk but without right log I can't
[Sony Cross-Device General] DuskGolem:
[MENTION=4120742]munjeni[/MENTION], can you please refer this poc log too, probably something wrong with my desktop OS.

One more thing, when previously i tried to modify stock kernel with [MENTION=398401]seraj[/MENTION]ir unofficial root kernel v5.23 which contained your old poc, magisk worked with that kernel...
[Sony Cross-Device General] munjeni:
Log is ok! You need to contact magisk developer and told him to add support for your stock kernel! I think things is not poc related. Or at least somehow give me kernel crash log
[Sony Cross-Device General] DuskGolem:
[MENTION=4120742]munjeni[/MENTION], would you mind looking in your tool again in the SONY RIC DISABLING PORTION? I was playing with your tool and serajir's unofficial root kernel tool and found something weird.

1) First I used serajir's tool to just disable dm-verity, sony RIC and force encrypt (no other option was marked "Y" except these 3). Then i used the resulting boot.img from this tool with your tool for TA restore and guess what you tool was again asking for disabling just RIC (dm-verity and forceencrypt passed your tool) although I have already disabled it using serajir's tool. Anyhow the resulting kernel booted without magisk but not with it as i have been complaining about it.

2)As serajir's tool contains your previous ta_poc, i then used this tool only to create modified kernel and it worked with all magisk versions even the latest beta.

P.S :sorry if this conversation is annoying you but brother i have a problem so i'm reporting......
[Sony Cross-Device General] munjeni:
No mate you not bothering! Main goal is having PoC compatible with every kernel. Can you post booth patched boot images?
[Sony Cross-Device General] DuskGolem:
here you go bro.
[Sony Cross-Device General] munjeni:
Found causal! Diferencie is:

PoC doesn't create vendor folder because there is symlink to the /system/vendor, if I delete vendor symlink and create vendor folder (like it was on rootkernel tool or serajr tool) than all old phones will get bootloop like my z1c. I will need to get kernel crash log and make a diferent workaround for things, I no want to break old phones :(

So if you need a temp fix you need init.vendor_ovl.sh script and whole folder "vendor" from rootkernel tool, than add this lines to the start of section "on post-fs"

mount securityfs securityfs /sys/kernel/security nosuid nodev noexec
chmod 0640 /sys/kernel/security/sony_ric/enable
write /sys/kernel/security/sony_ric/enable 0
mount none /system/vendor/lib /vendor/lib/bind_lib bind
mount none /system/vendor/lib64 /vendor/lib64/bind_lib64 bind
exec u:r:init:s0 -- /system/bin/sh /init.vendor_ovl.sh /vendor
restorecon_recursive /vendor

And you need to delete symlink - vendor@0644__lnk__

Don't know why, but magisk isue is reported for poc 2 months ago but nobody gaved kernel crash log, I can't fix without kernel crash log.
[Sony Cross-Device General] munjeni:
Yes thats ok, I have fully fixed ric isues, tool now search for string in all rc files and deletes every possible ric lines, than create right ric line in section on post-fs, you maybe see "ric is probably enabled" thats because tool found old ric line :)
[Sony Cross-Device General] DuskGolem:
Can you please elaborate, kind a noob in developing....:confused:
[Sony Cross-Device General] DuskGolem:
[MENTION=4120742]munjeni[/MENTION], you meant i have to modify the ramdisk everytime i use this tool???

Am i correct now??
[Sony Cross-Device General] DuskGolem:
[MENTION=4120742]munjeni[/MENTION], it didn't worked:crying:. Anyhow I will stick to the old POC in serajir's root kernel. I will keep trying to find a way to dump kernel crash log until then keep it up and thanks for the help anyway:):):).........
[Sony Cross-Device General] munjeni:
I have told dev of the magisk about symlink of the vendor folder problem, lets hope he do something
[Sony Cross-Device General] razzledazzle83:
I am trying to restore my DRM keys using your tool guys. First of all thanks a lot for providing such a great tool. Very appreciated.

One question though.

I'm using this tool with the XC Gensis kernel v1.05 non DRM version.

According to the author RIC is already disabled but your tool doesn't recognise it. It says "Sony RIC is probably enabled. Disable?". Since it should be disabled already I selected no but then it says "enabling RIC".

Does that mean that your tool actually does enable RIC actively even if it is disabled from the beginning?
[Sony Cross-Device General] Klaus N.:
The answer is just a few posts above yours.

So you have to say "Y" to the question "Sony RIC is probably enabled. Disable?" ;)
[Sony Cross-Device General] razzledazzle83:
Ok, I thought as much. Just wasn't sure.

Thanks for the answer.
[Sony Cross-Device General] Dave_247:
[MENTION=4120742]munjeni[/MENTION]

I'm getting the same issue with reboots at the Xperia logo on my Xperia X (F5121) after using poc and then installing Magisk. I've been looking at how to get the kernel panic but everything says it requires root, which is a problem as it isn't able to boot that far to enable it and I can't access the directory it should be in using TWRP either. (/sys/fs/pstore shows as empty).

I thought to try uninstall Magisk and then install SuperSU hoping it would at least boot so I could then grab the logs, but that seemed to make it even worse that not only did it get rebooting, but I flashing the original kernel image didn't work either as it just sat on the Sony logo, so I had to resort to reflashing the entire rom via Flashtool.

Considering SuperSU is affected as well it looks like ta-poc seems to be doing soemthing they both don't like, however without root I don't know how else to get the last_kmsg off my device to show to you.
[Sony Cross-Device General] munjeni:
Things is unrelated to PoC! For example try the same things without PoC and you will get the same result. :) I don't have idea whats going with it because nobody gaved me kernel crash log.
[Sony Cross-Device General] Dave_247:
Dammit you're right it's the same after using Tobias's rootkernel tool...

Ok I don't know how but I think I managed to get the kernel crash log. Turns out it was in /sys/fs/pstore after all.

I'm also not sure from which exact crash this is from as I've gone through so many, including installing Magisk 12 only to have that crash on me too after it booted, but it was enough to get me root which was the purpose so I can get the log.
[Sony Cross-Device General] munjeni:
I'm contacted dev of the magisk about this!
[Sony Cross-Device General] munjeni:
Can you give me sepolicy file from before magisk patched kernel and one after...? Need to get diferencie
[Sony Cross-Device General] munjeni:
Probably your question now is how to dump sepolicy after installing magisk and having bootloop? Simple temporary boot any cwm (fastboot boot recovery.img) and with adb dump whole boot partition, give me sepolicy file from system before installed magisk and give me that boot dump I will extract it byself
[Sony Cross-Device General] Dave_247:
After I can do easy, I can just boot into TWRP and use the file browser to copy the sepolicy file from the root directory to the internal storage, and then copy it onto my computer.

Before though I'm not so sure, is there a way I can get the file, or dump the patition without having root?

For now I've just attached the file from the root directory after installing ta-poc and Magisk without edting the poc scrpt yet.

Keep in mind I'm doing this with Magisk v12.0 as it's the only way I'm able to boot into the OS with root, even if it's just temporarily.

I'll try editing the poc script next and go through the whole process again to see if it makes any difference and upload the new kernel crash log.
[Sony Cross-Device General] munjeni:
You can't use twrp file browse since sepolicy is inside boot image ramdisk, thats a reason why you need to dump boot image! I need sepolicy from unpatched ramdisk and one sepolicy from boot image which have installed magisk. Only a way by now is to install magisk, than boot twrp temporary and dump that boot image which have boot loop, so after you gave me booth I will decompile booth and compare, than will let you know what might be a broblem. By now I am not surre but for me it looks like magisk broke sepolicy somehow.
[Sony Cross-Device General] Dave_247:
But I got these issues after installing SuperSU too, so either they are both doing something wrong or Sony has changed/updated something without us knowing.

Before I make any edits I just want to point out that the line you mentioned ($POC shell dalvikcache_data_file dir ) isn't in the fine at all. I've searched for even just "dalvikcache" yet nothing shows up. I've attached a screenshot of how my file is just in case, and will just add the lines from 378 onwards as you said.

Also attached are my sep-policy and kernel crash log after having gone though the patching process with the additions to the script, in case it is any different.
[Sony Cross-Device General] levone1:
Can you post bat you used for your Z1c?
[Sony Cross-Device General] x_one:
I have Z3C and I've just said that it's just text file that can be edited.

And if you have Z1C with fw older than MM just name your kernel file "kernel.elf" (if you don't konow how to edit *.bat), place kernel.elf and TA.img in folder with PoC, try DOUBLECLICKME_JB.bat and see what you will get.
[Sony Cross-Device General] x_one:
[MENTION=4120742]munjeni[/MENTION] just an idea..

Maybe add script file with root rights instead of tad to check if TA.img exists and have proper rights just before starting ta_static.. Something like ta_check. Then in ta leave only make last part with looping TA.img?

That could solve problem with not copying TA.img file..
[Sony Cross-Device General] munjeni:
First line on any script starts with #!/blabla so sript use that blabla, blabla must have rights for copy to data tmp, if we use blabla with rights other than tad we can't start tad_static since after marchmalow tad user only can start tad, thats it in short. Worst thing nothing about failed copy in any log so unable to debug what is going on. Sepolicy is also patched to alow tad user to copy to data tmp but seems it not working :(
[Sony Cross-Device General] x_one:
I understand that.

It's not possible to use blabla2 with other right than tad to make another script?

I'm not familiar with sepolicy so I can't try make it by myself.
[Sony Cross-Device General] munjeni:
What is id of the tad user?

id -u tad
[Sony Cross-Device General] x_one:
Got 2997
[Sony Cross-Device General] munjeni:
Are you on nougat?
[Sony Cross-Device General] x_one:
No, MM. Z3C don't have Nougat.
[Sony Cross-Device General] munjeni:
Ok, I will make an test version for MM, hope you give me dmesg if it fail?
[Sony Cross-Device General] x_one:
Off course.. If it will be possible to grab it.
[Sony Cross-Device General] munjeni:
this one for you! First of all delete TA.img from /data/local/tmp and do not copy it manualy, let see what is going on in dmesg :)
[Sony Cross-Device General] x_one:
TA.img not copied

http://pastebin.com/jc1QYCrd
[Sony Cross-Device General] munjeni:
Strange since nothing in dmesg about denial, and another strange thing tad_static exited with status 0 which mean ok :confused: Do you have mobile signal? Whats going on when you with root trought terminal emulator execute /stufs/bin/ta ?

Sorry you disaperared and I can wait, when you get ready to separate single hour of free time for this tell me and I will continue, until that I not going to fix since I have no device to test thing.
[Sony Cross-Device General] fluffi444:
Will test also. Same id here for tad. MM.
[Sony Cross-Device General] x_one:
Sorry.. I had put kids sleep ;)

No signal.

After runing /stufs/bin/ta file is copied with 660 and tad.root

And don't worry, take your time. PoC is working great but this copying. If I know what's going on I can copy it manually. Just want help figure it out.
[Sony Cross-Device General] fluffi444:
But actually it must be 0770.... and tad.tad...

${BB} chown tad.tad /data/local/tmp/TA.img
${BB} chmod 0770 /data/local/tmp/TA.img

EDIT

OK - I guess you are talking about an internal test version....
[Sony Cross-Device General] munjeni:
Great! Seems permissions is right now. Problem I think is that data is not mounted before tad executed script, I will try with an wait loop until data gets available hope it will work. Did you got signal after manual ta copy and reboot?
[Sony Cross-Device General] x_one:
After execute /stufs/bin/ta and reboot everything is working.
[Sony Cross-Device General] halfvast:
Thanks to the developer! Working fine with Xperia Z4 Tablet :) I have encountered one issue. I cannot get Adaway to apply adblocked hosts file. Must be a permission issue. I have Supersu 2.79.

Edit.

Solved issue with installing Magisk 11.1 with systemless hosts (Supersu 2.79).
[Sony Cross-Device General] munjeni:
If you installed magisk before su (or after su) its expected that booth will no more work because of magisk!

You can't use twrp file browse since sepolicy is inside boot image ramdisk, thats a reason why you need to dump boot image! I need sepolicy from unpatched ramdisk and one sepolicy from boot image which have installed magisk. Only a way by now is to install magisk, than boot twrp temporary and dump that boot image which have boot loop, so after you gave me booth I will decompile booth and compare, than will let you know what might be a broblem. By now I am not surre but for me it looks like magisk broke sepolicy somehow.

You no need to use poc patch right now since definitelly something is not a good in magisk installer, let give me sepolicy files first so I will tell you what is excatly problem here! I will try to identify isue and eventualy help magisk dev to give us fix