Bitcode Demystified
lowlevelbits.org
lowlevelbits.org
However, the article only mentioned that decompilation is easier with LLVM IR, because it is a more high-level language. It certainly is a valid point, but addresses the topic of binary obfuscation instead for algorithmic security.
I'm thus wondering if anyone can shed some light on the real security aspects. For example, let's say that I compile C that is supposed to run in constant time to LLVM IR and submit it to Apple. Does Apple guarantee that their blackbox optimizations do not introduce branches or other factors that may result in variable timing into a constant time algorithm? Can I do anything to ensure that my code will always run in constant time despite unknown optimizations being applied to it in the future?
As in, you can have just a single numberic constant in your code and Apple is permitted to insert a for loop up to that constant.
Finally, the bitcode_retriever code is fine, but you could get the same functionality with 3 lines of shell (`otool -l mybinary | grep -A 4 __bitcode` to get the part of the file containing bitcode and then use `dd` to extract that).
This is my impression, too, but it's always seemed strange to me - are the rare fix for a compiler bug and a few micro-optimizations worth all the effort?
As bla2 points out, it seems that the author has got entirely the wrong end of the stick. App thinning isn't related to bitcode. It's about delivering a program image that only contains the program for the instruction architecture of the downloading client. LLVM bitcode use is, rather, about holding off generating that final machine image until the point of download, rather than when the developer compiled the program, theoretically allowing improvements in code generation and IR lowering to be taken advantage of after a developer provides a compiled application to Apple.
A better treatment of the subject appears to be https://imore.com/app-thinning-ios-9-explained .