DynamoRIO / dynamorio

Dynamic Instrumentation Tool Platform
Other
2.62k stars 554 forks source link

add AArch64 support: master issue #1569

Open derekbruening opened 9 years ago

derekbruening commented 9 years ago

Split from issue #1551 as our initial focus is just AArch32.

toshipiazza commented 7 years ago

In api/samples/CMakeLists.txt I noticed that bbbuf.c is the only sample listed as not yet ported from AArch32 to AArch64. However #1982 modifies bbbuf.c to use drx_buf, to which AArch64 support was added (not by me).

Would someone with an AArch64 setup be able to verify it works and modify CMakelists.txt as appropriate?

fhahn commented 7 years ago

bbbuf was enabled on AArch64 a while ago by fa7e5c55d9a2526ae566b1e082ec23033b705196

toshipiazza commented 7 years ago

drx_buf_insert_buf_memcpy() and the related tests in drx_buf-test.dll.c were disabled for Aarch64 because of #2440. However, it looks like this was partially fixed by https://github.com/DynamoRIO/dynamorio/commit/3c49cc083dde66d47a58c29f8ba1d7996954dc68, enough so that the relevant XINST_CREATE_ macros are now there. Would anyone with an Aarch64 build be able to build/verify drx_buf_insert_buf_memcpy() works on Aarch64?

fhahn commented 7 years ago

@toshipiazza drx_buf-test.dll.c fails during execution, with all #ifndef AARCH64 removed #2520

derekbruening commented 7 years ago

Unfortunately we didn't have auto-links for partial commits so I'm pasting in the many commits contributing to the port so far:

2017-07-20 c908cddd i#1569 AArch64: Make encodings easier to specify. (#2549) 2017-07-12 654f7b2e i#1569 AArch64: Fix bug in encoding (SIMD structure load/store). (#2527) 2017-07-12 8d4d5edc i#1569 AArch64: Initialise variables in encoder functions. (#2528) 2017-07-11 69913cb2 i#1569 AArch64: In encoder/decoder, use all bits provided by pattern. (#2517) 2017-07-10 aec49770 i#1569 AArch64: Follow-up to 428b896: Use opndset for ADR and ADRP. (#2516) 2017-07-10 bc483ace i#1569 AArch64: Follow-up to 3275b81: check X30 opnd in encoder. (#2515) 2017-06-21 662d0940 i#1569 AArch64: Fix uninitialized variable error when building with GCC 7 on AArch64. (#2480) 2017-05-09 2fb8c254 i#1569 AArch64: Initialise the shared reset stub on AArch64. (#2424) 2017-05-09 42d0ebcf i#1569 AArch64: Implement move (immediate) to zero register. (#2423) 2017-05-09 a77808f0 i#1569 AArch64: Implement arch_mcontext_reset_stolen_reg. (#2422) 2017-05-02 5e98bc10 i#1569 AArch64: Enable syscall-mod test. (#2388) 2017-04-20 b98cdb80 i#1569 AArch64: Add macro to create BL instructions. (#2332) 2017-04-19 3275b814 i#1569 AArch64: Add support for implicit X30 operands for BL and BLR. (#2345) 2017-04-07 428b8965 i#1569 AArch64: Add macro to create ADR and ADRP instructions. (#2317) 2017-03-30 2ea03bb1 i#1569 AArch64: Print instruction if encoding fails. (#2315) 2017-03-30 3e18d736 i#1569 AArch64: Move assignments out of expressions in encode_gen.h. (#2314) 2017-03-28 2c4c19c4 i#1569 AArch64: Make dst reg also a src reg for BFM. (#2309) 2017-02-02 e25c65f6 i#1569 AArch64: update ISA references throughout the docs 2017-02-02 94727bc9 i#1569 AArch64: document that A64 is supported 2017-02-02 e574c28b i#1569 AArch64: add no32 support to package.cmake 2017-01-27 99734611 i#2130, i#1569: Port api/samples/div.c to AArch64 and enable it. 2017-01-27 3bfb9643 i#1569 AArch64: Port and enable api/samples/opcodes.c. 2017-01-15 fa7e5c55 i#1569 AArch64: Port and enable api/samples/bbbuf.c 2016-12-16 03ce33bd i#1569 AArch64: Add ARMv8.1 atomic instructions. 2016-12-13 f2a66694 i#1569 AArch64: Handle self-modifying programs. 2016-12-08 7ff49b09 i#1569 AArch64: Create clean_call_opt_shared.c and refactor. 2016-11-28 9451323c i#1569 AArch64: Allow smaller "Child hits" in drcachesim-phys.templatex. 2016-11-22 4a5189eb i#1569 AArch64: Rename members of callee_info_t. 2016-11-22 23a236ed i#1569 AArch64: Rename members of clean_call_info_t. 2016-11-21 93a3fef7 i#1569 AArch64: Remove INSTR_CREATE_xx and its uses. 2016-11-17 4c259cc3 i#1569 AArch64: Rename NUMXMM{REGS,SAVED,SLOTS} to NUMSIMD... 2016-11-16 c3bd1ca9 i#1569 AArch64: Replace cache_sync_asm with clear_icache, in C. 2016-11-15 c6a93e19 i#1569 AArch64: Implement flush_icache in suite/tests/tools.[ch]. 2016-11-11 a1331d54 i#1569 AArch64: Complete encode/decode of non-FP, non-SIMD instructions. 2016-11-03 580e5dc2 i#1569 AArch64: Fix codec bugs: LDP/STP size, ADD/SUB shift, pre_index. 2016-10-20 ca1808c7 i#1569 AArch64: Add --no-export-dynamic when building allasm_aarch64_cache. 2016-10-18 c54e068f i#1569 AArch64: Make dynamorio_syscall only read the 7th arg when used. 2016-10-13 6158cd04 i#1569 AArch64: Add pure-assembly test of drcachesim. 2016-10-13 5c2bc64b i#1569 AArch64: Implement drutil_expand_rep_string_ex. 2016-10-10 a73afa64 i#1569 AArch64: Add a pure-assembly ISA test. 2016-10-07 72f8d401 i#1569 AArch64: relax drcachesim output for A64 2016-10-04 1fb9c9ef i#1569 AArch64: Reimplement ELF import/export iterators. 2016-10-03 de022285 i#1569 AArch64: Fix drx_buf on AArch64. 2016-09-29 ec600f3d i#1569 AArch64: Add missing "flags" argument in call to SYS_unlinkat. 2016-09-28 6b577be4 i#1569 AArch64: Updates to api.dis-a64 test. 2016-09-28 7090b331 i#1569 AArch64: Change disassembly of offsets. 2016-09-23 0eb7ed61 Revert "i#1569 AArch64: Reimplement ELF import/export iterators." 2016-09-23 b92660f4 i#1569 AArch64: Reimplement ELF import/export iterators. 2016-09-23 bee1be5e i#1551 ARM, i#1569 AArch64: Port common.getretaddr to ARM and AArch64. 2016-09-23 96a1f3be i#1551 ARM, i#1569 AArch64: Port linux.infinite test to ARM and AArch64. 2016-09-23 e85c5d5b i#1551 ARM, i#1569 AArch64: Enable client.crashmsg and api.ir-static. 2016-09-21 e844d0d3 i#1729/i#1569 A64 traces: Reintroduce drcachesim trace_entryt packing. 2016-09-19 a5dc679d i#1729/i#1569 A64 traces: temporarily revert trace packing to fix A64 2016-09-16 f43e120a i#1569 AArch64: Add api.drdecode test for AArch64. 2016-09-16 6819e3f6 i#1569 AArch64: Make drcachesim template looser. 2016-09-15 f96ec6ee i#1569 AArch64: Disable tests that do not yet work on AArch64. 2016-09-15 fed02f63 i#1551 ARM, i#1569 AArch64: Make proc{save,restore}_fpstate a no-op. 2016-09-15 26025a56 i#1569 AArch64: Handle AArch64 in runsuite_common_pre.cmake. 2016-09-13 6d08225f i#1569 AArch64: Adapt debug check in translate_walk_restore. 2016-09-13 932f8f44 i#1569 AArch64: Fix drreg-test with double move to XZR. 2016-09-12 82dadac8 i#1569 AArch64: Implement dr_app_start and dr_app_running_under_dynamorio. 2016-09-12 a4d17050 i#1569 AArch64: Make drutil work with load/store (register). 2016-09-12 9fd9343a i#1569 AArch64: Handle LDRSW (literal). 2016-09-12 27e4737b i#1569 AArch64: Implement instr_is_mov_constant, instr_is_exclusive_store. 2016-09-12 b95d14c4 i#1569 AArch64: Change disassembly of B.cond and shift/extend operations. 2016-09-09 9f8099dc i#1569 AArch64: Implement insert_clear_eflags. 2016-09-05 521301ad i#1569 AArch64: Reimplement encoder and decoder. 2016-08-31 d8d99f12 i#1569,i#1551,i#975 static start/stop: disable on ARM and A64 2016-08-30 bed62b27 i#1569 AArch64: Add enums and struct members for memory operands. 2016-08-10 712b06fb i#1569 AArch64: Use user_pt_regs instead of user_regs_struct. 2016-08-08 e7b2650e i#1569: Fix AArch64 build broken by 914d4df. 2016-08-08 575e7a58 i#1569 AArch64: Make base_disp bitfields in opnd_t architecture-dependent. 2016-08-08 94423a2c i#1569 AArch64: Use negative disp rather than DR_OPND_NEGATED. 2016-07-27 7ee7189b i#1569 AArch64: Enable inlining of system calls. 2016-07-27 6f9a7a59 i#1569 AArch64: Adapt emit_special_ibl_xfer for AArch64 ibl routine. 2016-07-21 a23cf44a i#1569 AArch64: Implement dr_call_on_clean_stack. 2016-07-20 e1c79962 i#1569 AArch64: Fix instrace_simple and memtrace_simple. 2016-07-19 d039d22b i#1569 AArch64: Implement clean call. 2016-07-19 62798476 i#1569 AArch64: Implement some simple functions required by clients. 2016-07-18 1836b860 i#1569 AArch64: Adapt tests that use DynamoRIO extension libraries. 2016-07-14 cc362528 i#1569 AArch64: Correct definition of DR_REG_SYSNUM. 2016-07-13 2ab9b378 i#1569 AArch64: Implement dr_try_start. 2016-07-13 1b6a007a i#1569 AArch64: Implement resolver for TLS descriptors. 2016-07-13 fe1024cb i#1569 AArch64: Fix tracer.cpp. 2016-07-13 f55c242f i#1569 AArch64: Make drutil and drwrap work. 2016-07-11 dea5f2e8 i#1569 AArch64: Make drreg work. 2016-07-11 a9f37bd7 i#1569 AArch64: Replace ARM with AARCHXX in drsyms-test.templatex. 2016-07-08 3e3bba60 i#1569 AArch64: Add dis-a64 pre-commit test. 2016-07-07 9edd275a i#1569 AArch64: Add "nzcv" test, an alternative to "eflags" test. 2016-07-07 9f40776b i#1569 AArch64: Enable 7 additional "client.dr*" tests. 2016-07-04 e5f674e7 i#1569 AArch64: Make ELF_R_TLS_DESC fail at run time, not load time. 2016-07-04 ecdd2f75 i#1569 AArch64: Disable sign_extend_immed on AArch64. 2016-07-04 b86fc3a3 i#1569 AArch64: Make ELF_R_TLS_DESC fail at run time, not load time. 2016-07-04 f038052a i#1569 AArch64: Remove REG_X31_INVALID, and remove XZR from GPR range. 2016-07-01 067a239a i#1569 AArch64: Implement exchanging app's TLS. 2016-06-29 3375189d i#1569 AArch64: Fix polluted X1 in handlesigreturn. 2016-06-28 e445404a i#1569 AArch64: Implement "clone" system call. 2016-06-28 cd10b2c4 i#1569 AArch64: Implement simple functions in decode.c, instr.c, opnd.c. 2016-06-28 80892ff1 i#1569 AArch64: Implement insert{push,pop}_all_registers. 2016-05-13 ebde9bfc i#1569 AArch64: Implement emit_indirect_branch_lookup. 2016-06-28 5c6a68fd i#1569 AArch64: Add encode/decode of arithmetic and logical operations. 2016-06-28 e74114f6 i#1569 AArch64: Replace "AARCH64 || ARM" with AARCHXX in many places. 2016-06-28 0aceb3a4 i#1569 AArch64: Define AARCHXX when ARM or AARCH64 is defined. 2016-06-27 15291cae i#1569 AArch64: Add UAPI syscall numbers. 2016-06-21 f9989fda i#1569 AArch64: Bug fix in DEF_atomic_add_exchange. 2016-06-21 faf5b307 i#1569 AArch64: Work around incorrect definition of SIGSTKSZ. 2016-06-16 17ad1547 i#1569 AArch64: Implement primitive disassembly for "-loglevel 3". 2016-06-13 4c48376e i#1569 AArch64: Implement fragment unlinking. 2016-06-10 609b33ef i#1569 AArch64: Implement signal handling. 2016-06-10 5a466b11 i#1551 ARM, i#1569 AArch64: Replace atomic_xchg with atomic_swap. 2016-06-08 d56d87ac i#1569 AArch64: Improve alignment of simd data in {dr,priv}_mcontext_t. 2016-06-08 2f4ee9d9 i#1569 AArch64: Implement functions required for threadexit2 test. 2016-06-08 d966e7d2 i#1569 AArch64: Implement xfer_to_new_libdr. 2016-06-07 c49e30d3 i#1569 AArch64: Start implementing real instruction decoder/encoder. 2016-06-03 a64a62e6 i#1569 AArch64: Implement dynamorio_app_take_over. 2016-06-02 7007d243 i#1551 ARM, i#1569 AArch64: Fix call_with_retaddr and ret_noncall_trace.c. 2016-06-02 8b29fdcd i#1569 AArch64: Implement tests/security-common/codemod.c. 2016-06-02 43f52fc3 i#1569 AArch64: Fix dr_fpu_exception_init and test_call_switch_stack. 2016-06-02 14a14891 i#1569 AArch64: Implement restarting interrupted system calls. 2016-05-27 6f02d279 i#1569 AArch64: Distinguish SP (stack pointer) from ZR (zero register). 2016-05-26 a7909b23 i#1569 AArch64: Save X1 in emit_do_syscall_common. 2016-05-26 e79fec32 i#1569 AArch64: Handle SYS_readlinkat. 2016-05-24 d15e394c i#1569 AArch64: Improve handling of fragment prefixes. 2016-05-19 0f5898d1 i#1569 AArch64: Handle fork using "clone" in post_system_call. 2016-05-11 e0020848 i#1569 AArch64: Correctly mangle conditional branch using stolen reg. 2016-05-04 a38ff938 i#1569 AArch64: Implement cleanup_and_terminate. 2016-05-11 54cb6cc0 i#1569 AArch64: Implement a few missing assembler routines. 2016-05-11 3244f486 i#1569 AArch64: Implement MCXT_SYSNUM_REG and get_mcontext_frame_ptr. 2016-05-11 7e6ad68c i#1569 AArch64: Implement encode and decode of SVC instruction. 2016-05-11 5ed621bd i#1569 AArch64: Fix bug in branch patching and improve stub patching. 2016-05-06 f9dabc41 i#1569 AArch64: Implement stolen register mangling. 2016-05-06 505704a2 i#1569 AArch64: Add pessimistic register operands when decoding OP_xx. 2016-05-03 e9772cf2 i#1569 AArch64: Use predicate for B.cond instead of second operand. 2016-04-27 1140b8eb i#1569 AArch64: Change prototype of decode_sizeof. 2016-04-27 e0ed364d i#1569 AArch64: Remove dead "X64" code in arch/arm/. 2016-04-21 fc62ef06 i#1569 AArch64: Modify CMakeLists.txt to omit tests that do not build. 2016-04-21 464629d6 i#1569 AArch64: Implement miscellaneous missing things. 2016-04-21 6744477a i#1569 AArch64: Implement AArch64 parts of merged mangle.c. 2016-04-21 2fd8c4c5 i#1569 AArch64: Implement encoding for mangling LDR (literal, SIMD&FP). 2016-04-20 8cf22a9e i#1569 AArch64: Implement ATOMIC_4BYTE_WRITE and ATOMIC_8BYTE_WRITE. 2016-04-20 418c9b87 i#1569 AArch64: Implement suite/tests/tools.[ch]. 2016-04-20 58e1a2ba i#1569 AArch64: Implement cpuid_supported. 2016-04-19 c9eed16e i#1569 AArch64: Replace apsr/cpsr with nzcv, fpcr, fpsr. 2016-04-14 aefbf992 i#1569 AArch64: Implement parts of instr.c. 2016-04-14 13e5afd6 i#1569 AArch64: Implement parts of emit_utils.c and arch_exports.h. 2016-04-13 543ef984 i#1569 AArch64: Fix bug in dr_setjmp. 2016-04-12 51bd839f i#1569 AArch64: Implement atomic operations. 2016-04-12 f44cd917 i#1569 AArch64: Implement thread-local storage. 2016-03-23 66d0cc94 i#1569 AArch64: Add incomplete encoder and decoder. 2016-03-23 e09208e2 i#1569 AArch64: Implement functions in assembler source files. 2016-03-23 c4b55cb1 i#1569 AArch64: Adapt for syscalls that Linux arm64 does not have. 2016-03-22 318d1fea i#1569 AArch64: Use PTRACE_GETREGSET and PTRACE_SETREGSET. 2016-03-22 1b4b1f40 i#1569 AArch64: Add AArch64 cross-compilation to test suite. 2016-03-21 793392d3 i#1569 AArch64: Make AArch64 build. 2016-03-11 c2025c97 Revert "i#1569 AArch64: Add AArch64 cross-compilation to test suite." 2016-03-11 b1c621fe Revert "i#1569 AArch64: Make AArch64 build." 2016-03-11 05346edf i#1569 AArch64: Add AArch64 cross-compilation to test suite. 2016-03-11 c2ecca24 i#1569 AArch64: Make AArch64 build. 2016-03-03 cc19b1af i#1569 AArch64: Add files in core/arch/aarch64/. 2016-03-01 04391a54 i#1569 AArch64: Add three AArch64 files with work-in-progress stubs. 2016-02-29 82379f77 i#1569 AArch64: Implement basic build system. 2016-02-29 f57285f3 i#1569 AArch64: Add drsyms/libelftc-aarch64/. 2015-09-29 1ca28603 i#1569 port DynamoRIO to AArch64: disable installation check warning

egrimley commented 6 years ago

Full list of AArch64-tagged open issues: link

More important issues grouped and roughly prioritised:

1698 ldrex..strex pair constraints challenge instrumentation and even core operation

2626 Finish AArch64 encoder/decoder

2440 AArch64 is missing XINST_CREATE and INSTR_CREATE macros

2443 add exhaustive AArch64 decoder/encoder/macro consistency tests

2425 Node.js does not run under DynamoRIO on AArch64

2506 Crash running Java application on aarch64

2417 Fix flaky tests on AArch64

2065 several code emitting and patching routines fail to sync the hardware icache

2502 races in ARM lockless data structure reads

2358 CRASH on AArch64 when many signals are received

2154 BUILD: Building for Android AARCH64 on Linux

1621 clean call optimizations on AArch64: out-of-line, analyze and reduce cxt sw, inline

xxxxx Port Dr Memory to AArch64

2210 AArchXX clean calls handle far too few use cases, blocking tool development

2072 drreg-test fails with non-default stolen register

1936 DynamoRIO fails to run trivial "clone" example on ARM

2390 Reduce overhead of indirect branch on AArch64