@@ -166,3 +166,50 @@ The environment variable FAKETIME can be changed at application run-time
166166and always takes precedence over other user-controlled settings. It can
167167be re-set to 0 (zero) to work around potential incompatibilities or if
168168you do not want libfaketime applied to your software.
169+
170+ 5) Working with the new arm64e system binaries in Apple Silicon
171+ ---------------------------------------------------------------
172+
173+ Since Apple Silicon, Apple started shipping system binaries compiled against
174+ the `arm64e` ABI. This new ABI enforces Pointer Authentication Codes (PACs),
175+ and enforces assembly instructions to sign and check pointer signatures to
176+ prevent malicious control flow altering.
177+
178+ $ file /bin/date
179+ /bin/date: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
180+ /bin/date (for architecture x86_64): Mach-O 64-bit executable x86_64
181+ /bin/date (for architecture arm64e): Mach-O 64-bit executable arm64e
182+
183+ Most importantly, the new `arm64e` ABI is incompatible with the normal `arm64`
184+ ABI we are used to; this is done so that everything `arm64e` is PAC-enforced.
185+
186+ As a result, this will happen when we try to hook naive `arm64` libfaketime on
187+ system binaries (and vice versa with `arm64e` libfaketime on `arm64` binaries):
188+
189+ $ DYLD_INSERT_LIBRARIES=libfaketime.1.dylib /bin/date
190+ dyld[5788]: terminating because inserted dylib 'libfaketime.1.dylib' could not be loaded:
191+ tried: 'libfaketime.1.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'arm64e'))
192+
193+ Since PR #497, we now compile libfaketime with a fat library/binary setup, so
194+ that we support both ABIs at the same time:
195+
196+ $ file libfaketime.1.dylib
197+ libfaketime.1.dylib: Mach-O universal binary with 2 architectures: [arm64:Mach-O 64-bit dynamically linked shared library arm64] [arm64e:Mach-O 64-bit dynamically linked shared library arm64e]
198+ libfaketime.1.dylib (for architecture arm64): Mach-O 64-bit dynamically linked shared library arm64
199+ libfaketime.1.dylib (for architecture arm64e): Mach-O 64-bit dynamically linked shared library arm64e
200+
201+ Unfortunately, Apple does not support running third-party `arm64e` code yet,
202+ since the ABI is still unstable. This means that you cannot use libfaketime
203+ on system `arm64e` binaries out of the box, at the time of writing.
204+
205+ If you really need to, you may disable SIP in the recovery terminal:
206+
207+ (in recovery) # csrutil disable
208+
209+ And enable the experimental ABI after boot:
210+
211+ (in regular boot) $ sudo nvram boot-args=-arm64e_preview_abi
212+
213+ Then `arm64e` should work as-is. This use case is rather uncommon since most
214+ userspace binaries will remain `arm64` for the time being, until Apple really
215+ doubles down on `arm64e`. Regardless, we should be prepared for that.
0 commit comments