News for hackers. Stuff that matters.
Re:QEMU for iOS by saagarjha on Saturday February 22, 2020 @02:59AM (#22389928)
The app pretends to debug itself, which tricks the kernel into allowing it to flip the permissions of pages between write and execute. To do this it needs the get_task_allow entitlement.
Re:QEMU for iOS by asveikau on Saturday February 22, 2020 @03:46AM (#22390042)
Ah ok. So everything with a JIT will need this. I think I might even have read that somewhere long ago.

This is a weird thing by the way. It seems to me like you should be able to debug or do VM syscalls against yourself because there is no escalation of privilege. Debugging another process makes much more sense to block. But maybe my opinion is invalid because I also happen to think disallowing jit with kernel permissions is very silly. (Maybe dropping ability to do this in the style of openbsd's pledge(2) would be appropriate, but only for a process that really wants extra security.)

Re:QEMU for iOS by saagarjha on Saturday February 22, 2020 @04:21AM (#22390127)
> So everything with a JIT will need this.

Actual JITs (ones blessed by Apple, not hacks like these) possess the dynamic-codesigning entitlement, and can just make RWX pages.

> But maybe my opinion is invalid because I also happen to think disallowing jit with kernel permissions is very silly.

Your opinion isn't invalid, but it goes against Apple's security model of iOS (namely: apps should not be able to modify themselves).

Re:QEMU for iOS by asveikau on Saturday February 22, 2020 @02:25PM (#22392777)
> Your opinion isn't invalid, but it goes against Apple's security model of iOS (namely: apps should not be able to modify themselves).

And my position is this is a silly approach, or, maybe is ok but should be opt-in, or perhaps opt-out with third parties being automatically trusted to decide they want to use JIT without hoops.

W^X is good default policy but Apple's policy is unreasonable and paranoid.

Re:QEMU for iOS by swiley on Saturday February 22, 2020 @05:12AM (#22390243)
I can’t remember weather it was ish or some JS thing but you can do a kind of JIT without RWX by setting up chains of functions that tailcall eachother.
Re:QEMU for iOS by saagarjha on Saturday February 22, 2020 @05:49AM (#22390346)
iSH has a threaded interpreter that works like that, yes.