Advertising (This ad goes away for registered users. You can Login or Register)

anyway to unload modules without sceUtilityUnloadModule?

This is the development forum of the half-byte loader project. For general Half Byte Loader questions, visit the Half Byte Loader forum.
Forum rules
This forum is for HBL Development discussions ONLY. For User support or HBL general discussions, go to viewforum.php?f=3 . Messages that are not development related will be deleted.
Locked
wololo
Site Admin
Posts: 3621
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

anyway to unload modules without sceUtilityUnloadModule?

Post by wololo »

As you might have guessed by the title, an exploit I am working on does not import sceUtilityUnloadModule.
I've used my trick from last month to load as much as I can and retrieve some essential nids from additional modules (+ p5 stubs), but that function is nowhere to be found. For now I can probably try to live without it, but it would be great to be able to unload modules though... at least the one from the game...
Advertising
If you need US PSN Codes, this technique is what I recommend.

Looking for guest bloggers and news hunters here at wololo.net, PM me!
wololo
Site Admin
Posts: 3621
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: anyway to unload modules without sceUtilityUnloadModule?

Post by wololo »

Update:
I have access to SysMemUserForUser_35669D4C which seems to be an equivalent for sceKernelSelfStopUnloadModule.

Not sure how I can leverage that though, I assume to stop the game module I need to be in the game's thread, and if I do that, then some things will stop working...
An idea is probably to force each module/thread to jump to that function from within its own memory space...

I think I have the idea but if somebody has the actual code to handle that I would be super grateful.

TL,DR: the game is to reimplement sceUtilityUnloadModule with sceKernelSelfStopUnloadModule (or, in my case, SysMemUserForUser_35669D4C)
Advertising
If you need US PSN Codes, this technique is what I recommend.

Looking for guest bloggers and news hunters here at wololo.net, PM me!
JJS
Big Beholder
Posts: 1416
Joined: Mon Sep 27, 2010 2:18 pm
Contact:

Re: anyway to unload modules without sceUtilityUnloadModule?

Post by JJS »

I am not sure the kernel will like that. It probably thinks that the utility module is still loaded and you won't be able to reload it later with sceUtilityLoadModule.

This is only my guess though. Maybe you should test this on a PSP with CFW first by writing a small program that loads a utility with sceUtilityLoadModule. Then you unload the module through PSPLink (easier than trying to get the module id and doing it in the program I think). And then have the program try to load the utility module again.
m0skit0
Guru
Posts: 3817
Joined: Mon Sep 27, 2010 6:01 pm

Re: anyway to unload modules without sceUtilityUnloadModule?

Post by m0skit0 »

I'm not so sure you can't reload it later. Savegame module for example loads and unloads a lot of times (not sure if this is what you mean though).
I wanna lots of mov al,0xb
Image
"just not into this RA stuffz"
wololo
Site Admin
Posts: 3621
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: anyway to unload modules without sceUtilityUnloadModule?

Post by wololo »

m0skit0 wrote:I'm not so sure you can't reload it later. Savegame module for example loads and unloads a lot of times (not sure if this is what you mean though).
That's not what he meant. He meant that if the module is not unloaded properly, the kernel might think it is still loaded, and therefore refuse to load it a second time.

JJS: at the very least if I can unload the game's main module, I'll free somewhere between 5 and 10MB, which will put me in a more acceptable situation. And this one, I never need to reload :)
If you need US PSN Codes, this technique is what I recommend.

Looking for guest bloggers and news hunters here at wololo.net, PM me!
wololo
Site Admin
Posts: 3621
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: anyway to unload modules without sceUtilityUnloadModule?

Post by wololo »

Sigh, I just can't get it to work.
I wasted close to 10 hours on this lead. I'm sure there has to be a way to stop that module, and it's probably a simple mistake on my end, but it just refuses to stop.

For now I'll assume that a game that does not import sceUtilityUnloadModule is probably a no go.
It sucks because I did manage to load homebrews with that exploit, just not complicated ones :(
If you need US PSN Codes, this technique is what I recommend.

Looking for guest bloggers and news hunters here at wololo.net, PM me!
wololo
Site Admin
Posts: 3621
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: anyway to unload modules without sceUtilityUnloadModule?

Post by wololo »

Hmm, my problem is elsewhere. sceUtitlityUnloadModule is only to unload those external user mode modules.
Now I realize I have only 15MB of contiguous ram after freeing, despite having 24MB total. A few "small" things are in the middle of the user ram and not getting freed, this could be one of my issues
If you need US PSN Codes, this technique is what I recommend.

Looking for guest bloggers and news hunters here at wololo.net, PM me!
vonjack
Developer
Posts: 16
Joined: Wed Oct 02, 2013 12:43 pm
Location: China

Re: anyway to unload modules without sceUtilityUnloadModule?

Post by vonjack »

Oh, I encountered the same question as wololo.
Can ModuleMgrForUser_8F2DF740 unload modules correctly ?
And I've found p5_stubs contains "sceKernelLoadModule", can we use this syscall to replace "sceUtilityLoadModule" (use /kd/.prx in flash0 et al.).
Thank you very much!
PSP-1006(HK) FW6.60 Pro-C2 MOD
PCH-1006(HK) FW3.36. Numblast, ARK2, POPS
qwikrazor87
Guru
Posts: 2874
Joined: Sat Apr 21, 2012 1:23 pm
Location: The North Pole

Re: anyway to unload modules without sceUtilityUnloadModule?

Post by qwikrazor87 »

In usermode the only place you'll be able to load modules from is disc0:/
loading from any other place (flash0, ms0) will return error 0x80020146 (ERROR_KERNEL_PROHIBIT_LOADMODULE_DEVICE)
PSP 2001 - TA-085 - 6.61 PRO-C2
PS Vita 3G - PCH-1101 - 3.65 HENkaku Ensō
Alcatel phone - Android 8.1.0
Laptop - Toshiba Satellite L305D-S5974 - Ubuntu 16.04 LTS
vonjack
Developer
Posts: 16
Joined: Wed Oct 02, 2013 12:43 pm
Location: China

Re: anyway to unload modules without sceUtilityUnloadModule?

Post by vonjack »

qwikrazor87 wrote:In usermode the only place you'll be able to load modules from is disc0:/
loading from any other place (flash0, ms0) will return error 0x80020146 (ERROR_KERNEL_PROHIBIT_LOADMODULE_DEVICE)
Oh, Thank you very much!
I found after I used ModuleMgrForUser_8F2DF740 to stopunload module, and reload module (0x300) use sceUtilityLoadModule, it still return "Already Loaded" in VHBL.
It seems that not to unload module, VHBL is also running regular, so I'll give up to unload module. xD
PSP-1006(HK) FW6.60 Pro-C2 MOD
PCH-1006(HK) FW3.36. Numblast, ARK2, POPS
Locked

Return to “Half Byte Loader Development”