Advertisement
GeeckoDev

syscall 0x0 explanation

Mar 10th, 2013
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.61 KB | None | 0 0
  1. <artart78> will be easier probably ;)
  2. <artart78> hi Felix91 by the way
  3. <artart78> geecko: have you RE'ed that sceGe_lazy function entirely so we can take a look at it?
  4. <geecko> only a part of it
  5. <geecko> wait a sec
  6. <artart78> weird fact: this function is called by no firmware module apparently, but is a kernel function
  7. <geecko> it is incomplete and mostly unverified
  8. <geecko> but here it is: http://pastebin.com/WafaUFcJ
  9. <Felix91> Hey artart
  10. <artart78> hm, not really helpful since the sub call doesn't appear in it
  11. <artart78> now I'm really wondering: what the heck is that function!?
  12. <geecko> put the subcall just before "$at = 0" :p
  13. <Felix91> It looks quite ugly, that function.
  14. <artart78> it is completely unused
  15. <artart78> so maybe just debugging stuff?
  16. <geecko> so i can drop it ? :o
  17. <Felix91> Hmm, not sure, as Sony normally just writes return 0; for debug functions. However, the left entire unused modules on the FW so it could be debug.
  18. <Felix91> *they
  19. <artart78> that function was added in 4.xx apparently
  20. <Felix91> well, as long as there is no call to that function, you can leave it out.
  21. <artart78> geecko: yes, probably
  22. <artart78> would be interesting to know what it does though
  23. <geecko> how did you verify that it is not called?
  24. <artart78> no occurence of the "sceGe_lazy" string in the other PRXes, which would be needed for them to import it
  25. <geecko> ok
  26. <artart78> that function wasn't here in 3.52 and was here in ~4.01
  27. <geecko> what is libsceGe_lazy.a?
  28. <artart78> oh wait
  29. <artart78> this function actually *is* used
  30. <artart78> my bad
  31. <geecko> ew
  32. <artart78> not as an export
  33. <artart78> but it's the second argument ($a1) passed to sceKernelSetUsersystemLibWork()
  34. <geecko> :o
  35. <geecko> you are right
  36. <geecko> s/0x140/sceGe_lazy_31129B95/ :D
  37. <artart78> so
  38. <artart78> it can be accessed either inside sysmem (but I don't think it is, I don't want to search for it but according to the big part of sysmem I RE'ed which is still lying on my computer) or through sceKernelGetUsersystemLibWor
  39. <artart78> k
  40. <artart78> which is an user call!!
  41. <geecko> so? รดo
  42. <artart78> and guess which module uses sceKernelGetUsersystemLibWork()?? ge.prx!
  43. <geecko> makes sense :p
  44. <artart78> so
  45. <Felix91> Indeed, inside sysmem (sceKernelSetUsersystemLibWork(), Sony bitwise AND's a value (based on $k1) with its address and makes an illegal address check based on that result. It does not call it.
  46. <artart78> sceKernelGetUsersystemLibWork() + 8 contains the function
  47. <artart78> Felix91: hm? what are you talking about?
  48. <artart78> oh nvm
  49. <artart78> I hadn't understood
  50. <artart78> well it could call it at another place using the pointer it stores
  51. <artart78> which is what I'm too lazy to look for ;) but from what I've seen, it's not called
  52. <artart78> geecko: !!!!!!
  53. <geecko> wut
  54. <Felix91> Ah, Yeah, I did not see the sw $a1, 8($a3) at the end of that function :p
  55. <artart78> *(int *)(str2 + 204) = ((g_AwQueue.syscallId << 6) & 0x03FFFFC0) | 0xC;
  56. <artart78> the syscall id IS replaced!
  57. <artart78> hurrah!
  58. <Felix91> Right, I did not see it being called inside sysmen at some point on first view.
  59. <artart78> g_AwQueue.syscallId = sceKernelQuerySystemCall((void*)sceGeListUpdateStallAddr);
  60. <geecko> sceGeListUpdateStallAddr it is?
  61. <artart78> that stuff make sense
  62. <artart78> and I've also found one of the issues why ge.prx couldn't work lol
  63. <artart78> hm wait actually since I'm using the original usersystemlib.prx, using that "+ 204" shouldn't cause any problem, nvm
  64. <artart78> the function seems to only be called with ONE game
  65. <artart78> ULJM05086
  66. <artart78> Genso Suikoden 1
  67. <artart78> okay so I got it all
  68. <artart78> tell me if you need explanations geecko
  69. <geecko> so which function is called?
  70. <artart78> 0x03E00008
  71. <artart78> would that be a jr $ra by any chance?
  72. <artart78> *checks*
  73. <artart78> yes! great
  74. <artart78> soooo
  75. <artart78> * some studio created the game Genso Suikoden 1, calling sceGeListUpdateStallAddr "all the time" (don't really know actually)
  76. <Felix91> hehe
  77. <Felix91> pretty great analysis
  78. <artart78> * PSP updated its firmware, and that game was calling too many times that function for it to work correctly on higher firmware versions/other hardwares
  79. <artart78> * Sony created the sceGe_lazy_... function because the guys from this studio are LAZY and didn't do things correctly
  80. <artart78> * that function is stored using sceKernelSetUsersystemLibWork(), and ge.prx recovers it using sceKernelGetUsersystemLibWork()
  81. <artart78> * ge.prx modifies that 'syscall' call for the syscall id to match sceGeListUpdateStallAddr's one, which means, for that 'sub_' called by sceGe_lazy to call sceGeListUpdateStallAddr
  82. <artart78> * if the game name matches (Genso Suikoden 1), ge.prx replaces this game's call to sceGeListUpdateStallAddr by a call to its sceGe_lazy function
  83. <artart78> that's all
  84. <artart78> btw, obvious kernel exploit there
  85. <geecko> dafuq :o
  86. <Felix91> Exactly, excellent work here, artart. It took me a bit longer than you to figure that out.
  87. <Felix91> Heh, that's why I always enjoyed working with you.
  88. <artart78> (kernel exploit for Genso Suikoden 1 only though ;p)
  89. <artart78> Felix91: thank you :)
  90. <geecko> how can you exploit it?
  91. <artart78> hm actually maybe not that easy due to $k1 checks upon sceKernelSetUsersystemLibWork() addresses
  92. <artart78> ah but nvm, that'd only allow user access since the function is called by the game anyway
  93. <artart78> nvm
  94. <geecko> it is a great discovery though
  95. <Felix91> Alright, I'm out. There was finally some PSP dev talk again, haha
  96. <artart78> yes :)
  97. <artart78> bye Felix91
  98. <artart78> hope we can talk again soon about more interesting PSP stuff ;)
  99. * Felix91 est parti (Quit: Leaving)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement