Skip to content

Port to iOS/arm64e#548

Merged
atgreen merged 1 commit intolibffi:masterfrom
frida:feature/ios-arm64e
Mar 10, 2020
Merged

Port to iOS/arm64e#548
atgreen merged 1 commit intolibffi:masterfrom
frida:feature/ios-arm64e

Conversation

@oleavr
Copy link
Contributor

@oleavr oleavr commented Mar 9, 2020

Related to #491.

@oleavr oleavr force-pushed the feature/ios-arm64e branch from 5e8eae2 to 32b4b37 Compare March 9, 2020 03:02
@atgreen
Copy link
Member

atgreen commented Mar 9, 2020

Thanks for this! I apologize for all of the travis PR tests failing. I just fixed this in trunk. Could you please merge from trunk and try again? It just fixes the way travis works -- no changes to libffi.

@oleavr oleavr force-pushed the feature/ios-arm64e branch from 32b4b37 to 913deab Compare March 9, 2020 18:00
@atgreen
Copy link
Member

atgreen commented Mar 9, 2020

Ok, these test results are helpful now! It looks like these tests are mostly (all?) failing thanks to the compiler's stack smashing checks: https://rl.gl/doc?id=RLGL-OQN7PJZ6
If you click on the "Original Report" link you'll get the test log.

@oleavr
Copy link
Contributor Author

oleavr commented Mar 9, 2020

@atgreen Thanks for the quick review! Hmm, all of my changes are behind #if FFI_EXEC_TRAMPOLINE_TABLE && defined(__MACH__), so they're only going to have an impact on iOS/arm and arm64. (Unless the BR and BLR macros somehow conflict with a system header? But that would result in a compilation error.) Could it be a fluke or am I missing something? 😅

@atgreen
Copy link
Member

atgreen commented Mar 9, 2020

Ah.. interesting. The build failed because your patch has a clang-ism. The test script keeps going, however, and picks up the old system libffi library. So it looks like we both have some work to do...

: libtool: compile: gcc -DHAVE_CONFIG_H -I. -I.. -I. -I../include -Iinclude -I../src -I. -I../include -Iinclude -I../src -MT src/aarch64/sysv.lo -MD -MP -MF src/aarch64/.deps/sysv.Tpo -c ../src/aarch64/sysv.S -fPIC -DPIC -o src/aarch64/.libs/sysv.o
../src/aarch64/sysv.S:61:68: error: missing binary operator before token "("
#if FFI_EXEC_TRAMPOLINE_TABLE && defined(MACH) && __has_feature(ptrauth_calls)
^
../src/aarch64/sysv.S:282:68: error: missing binary operator before token "("
#if FFI_EXEC_TRAMPOLINE_TABLE && defined(MACH) && __has_feature(ptrauth_calls)

@oleavr oleavr force-pushed the feature/ios-arm64e branch from 913deab to 1ac6b0c Compare March 9, 2020 23:09
@oleavr
Copy link
Contributor Author

oleavr commented Mar 9, 2020

Oops! Sorry about that. Just pushed an updated version. Not super-elegant though, wondering if it would be cleaner to do the check once in configure.ac and introduce HAVE_PTRAUTH?

@oleavr oleavr force-pushed the feature/ios-arm64e branch from 1ac6b0c to 8f4073e Compare March 9, 2020 23:45
@oleavr oleavr force-pushed the feature/ios-arm64e branch from 8f4073e to 9375a91 Compare March 9, 2020 23:51
@oleavr
Copy link
Contributor Author

oleavr commented Mar 9, 2020

@atgreen Updated to use HAVE_PTRAUTH as determined by configure.ac. Figured it will make it easier to support GCC and Linux targets later. Let me know what you think. (Happy to revert to the previous approach in case it's preferable.)

@atgreen atgreen merged commit 4c7bde3 into libffi:master Mar 10, 2020
@oleavr oleavr deleted the feature/ios-arm64e branch March 10, 2020 01:06
jeremyhu added a commit to jeremyhu/libffi that referenced this pull request May 29, 2020
@jeremyhu
Copy link
Contributor

@here, please see #565 as I would value your input there. Thanks.

jeremyhu added a commit to jeremyhu/libffi that referenced this pull request Oct 1, 2020
jeremyhu added a commit to jeremyhu/libffi that referenced this pull request Oct 1, 2020
It is no longer allowed to simply vm_remap code pages willy-nilly.  Only entire
signed executable segment of a dylib may be remapped.  Accordingly, we need a
helper dylib (called libffi-trampolines.dylib) to support our use of vm_remap
for trampolines.

NOTES: This changes the ptrauth support from libffi#548 to match what Apple is
       shipping in its libffi-27 tag.

TODO: Split arm64e ptrauth parts out from trampoline parts
      Add autoconf-based build logic for the whole dylib trampoline support

Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
jeremyhu added a commit to jeremyhu/libffi that referenced this pull request Oct 1, 2020
It is no longer allowed to simply vm_remap code pages willy-nilly.  Only entire
signed executable segment of a dylib may be remapped.  Accordingly, we need a
helper dylib (called libffi-trampolines.dylib) to support our use of vm_remap
for trampolines.

NOTES: This changes the ptrauth support from libffi#548 to match what Apple is
       shipping in its libffi-27 tag.

TODO: Split arm64e ptrauth parts out from trampoline parts
      Add autoconf-based build logic for the whole dylib trampoline support

Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
jeremyhu added a commit to jeremyhu/libffi that referenced this pull request Jan 19, 2021
…i port

NOTES: This changes the ptrauth support from libffi#548 to match what Apple is
       shipping in its libffi-27 tag.

Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
jeremyhu added a commit to jeremyhu/libffi that referenced this pull request Jan 19, 2021
…i port

NOTES: This changes the ptrauth support from libffi#548 to match what Apple is
       shipping in its libffi-27 tag.

Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
jeremyhu added a commit to jeremyhu/libffi that referenced this pull request Jan 19, 2021
…i port

NOTES: This changes the ptrauth support from libffi#548 to match what Apple is
       shipping in its libffi-27 tag.

Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
jeremyhu added a commit to jeremyhu/libffi that referenced this pull request Jan 19, 2021
…i port

NOTES: This changes the ptrauth support from libffi#548 to match what Apple is
       shipping in its libffi-27 tag.

Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
jeremyhu added a commit to jeremyhu/libffi that referenced this pull request Mar 12, 2021
…i port

NOTES: This changes the ptrauth support from libffi#548 to match what Apple is
       shipping in its libffi-27 tag.

Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
atgreen pushed a commit that referenced this pull request Mar 24, 2021
…i port (#565)

NOTES: This changes the ptrauth support from #548 to match what Apple is
       shipping in its libffi-27 tag.

Signed-off-by: Jeremy Huddleston Sequoia <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants