4 ms·
Apple could just not have private APIs. At the very least, they could be impossible to access. If they have to exist at all, they could be in a separate library
by burfog 7y ago
Apple could just not have private APIs. At the very least, they could be impossible to access. If they have to exist at all, they could be in a separate library with permissions that prevent it from being read or mapped into memory.
If the APIs didn't exist, then there would be no need for Apple to check and there would be no developers tempted to use anything private.
- saagarjha 7y agoApple cannot do this because their (user-space) libraries need to call these internally, and they are mapped into an application's process.
- scarface74 7y agoAgain this shows a complete lack of understanding how software development works. If you have a public function “A” that is implement using private methods B,C,D. The implementor is free to change B, C, D or completely get rid of them to implement A. This is software engineering 101. Apple was able to make multiple cpu transitions doing this. Back in the PPC days, non native apps could run at near native speeds calling public APIs that were implemented by changing the private interface.
- burfog 7y agoPut B,C,D on the other side of a privilege boundary. Most obviously, they can go in the kernel. They can go in a separate process, using the Mach messaging that Apple so loves. There are other designs, as seen in Multics and VMS, with semi-privileged libraries. One could implement semi-privileged libraries on ARM by switching to a different page table when an attempt is made to run the library code. For secured forms of code like WebAssembly and the JVM, simply validate at load time that there will not be calls to non-whitelisted library functions.
- scarface74 7y agoThere is always a performance penalty when switching between “rings”. Private methods are an “implementation detail” that shouldn’t be depended on. Would you write a C++ program that called private functions using pointers? Would you write a C# program that called a private method using reflection? Should the dependency maintainer have the expectation of people calling private methods and not break your code? Every suggestion you have leads to performance issues.