5 ms·
> The second is using hot code push to violate app store review guidelines, like the use of private APIs. I've never understood this part. Why doesn't iOS sim
by amluto 10y ago
> The second is using hot code push to violate app store review guidelines, like the use of private APIs.
I've never understood this part. Why doesn't iOS simply prevent apps from calling private APIs?
- sjwright 10y agoPresumably because many private APIs are used behind the scenes by public APIs and the security model must allow applications to run them.
- Elizzy 10y agoBecause some of these APIs are useful in an enterprise app setting that aren't distributed via the App Store. Like Disney applications on their turnstile devices at Disney World.
- marcoperaza 10y agoYou aren't supposed to call private APIs in your code, but your app is definitely making private API calls all the time since the libraries provided by the platform are running in-process.
- euyyn 10y agoPreventing it in a technical way is far from easy: If your app calls public API X, which as part of its implementation calls private API Y, your compiler only needs a declaration of Y to output the function call / ObjC message send. Nothing in the language prevents it, and the code is executed natively unlike Java.
- tluyben2 10y agoThey control the software and the hardware though: seems possible to allow a specific region of memory (aka their public API) to call a specific region of memory (private API) and segfault for all the rest that does that?
- jahewson 10y agoMany private APIs are methods on objects which are part of public APIs, so there's no "region" of memory which cleanly corresponds to private APIs.
- tluyben2 10y agoBut they can theoretically create that as they own the entire chain; dev env, tools, OS, software, hardware (CPU included). I know it is not currently the case, sure, but they can do it was my point.
- euyyn 10y agoThey "own" a compiler, but not all of them. Say they implement the scheme you mention in clang and the LLVM linker, so the function bodies of their public APIs end up placed in that privileged region of memory, and those of their private APIs end up in the restricted region. Nothing prevents gcc from producing object files that tell the linker "this user function is part of Apple's public APIs". And nothing prevents people from using a different linker anyway, one that would put private API body functions out of the restricted region of memory. The only real way to achieve that would be to move all their frameworks to the kernel, which would be all sorts of problematic.
- Dylan16807 10y ago> Say they implement the scheme you mention in clang and the LLVM linker, so the function bodies of their public APIs end up placed in that privileged region of memory, and those of their private APIs end up in the restricted region. Agreed that this design is fundamentally flawed, but that's because the coder is providing the implementations of private code. Providing that is Apple's job. Put privileged code into a dynamically-linked library that Apple provides. Only code in that block of memory can call private APIs. Pretty straightforward to implement, and requires nothing fancy from the kernel. Of course this only works if you can prevent the attacker from corrupting memory.