Skip to content

Commit

Permalink
i#4474: Port security-common.retexisting test to AArch64 (#6875)
Browse files Browse the repository at this point in the history
Port security-common.retexisting test to AArch64.

Issue: #4474
  • Loading branch information
philramsey-arm authored Jul 12, 2024
1 parent 20d4548 commit fa2475b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
6 changes: 5 additions & 1 deletion suite/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5888,13 +5888,17 @@ if (NOT RISCV64) # TODO i#3544: Port tests to RISC-V 64
tochcon(security-common.codemod execmem_exec_t)
mark_execstack(security-common.codemod)
endif (NOT RISCV64)

if (X86 OR AARCH64) # FIXME i#1551: port asm to ARM
tobuild(security-common.retexisting security-common/retexisting.c)
endif (X86 OR AARCH64)

if (X86) # FIXME i#1551, i#1569: port asm to ARM and AArch64
# FIXME i#1308, i#2216: fails non-deterministically on Travis
set(decode_bad_stack_name security-common.decode-bad-stack_FLAKY)
tobuild(${decode_bad_stack_name} security-common/decode-bad-stack.c)
tochcon(${decode_bad_stack_name} execmem_exec_t)
mark_execstack(${decode_bad_stack_name})
tobuild(security-common.retexisting security-common/retexisting.c)
endif (X86)
if (PROGRAM_SHEPHERDING) # relies on being aborted on .B violation
tobuild(security-common.jmp_from_trace security-common/jmp_from_trace.c)
Expand Down
11 changes: 6 additions & 5 deletions suite/tests/security-common/retexisting.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,15 @@ START_FILE
DECL_EXTERN(precious)

/* ring() returns to this code, at which point we have exactly 16-byte
* alignment. However, the ABI expects there to be a retaddr on the stack and
* the stack to be 16-byte alinged minus 8. We use this trampoline to push a
* fake retaddr to match the ABI.
* alignment. On X86 the ABI expects there to be a retaddr on the stack and
* the stack to be 16-byte aligned minus 8. Push a fake retaddr to match the ABI.
*/
DECLARE_FUNC(precious_push_fake_retaddr)
GLOBAL_LABEL(precious_push_fake_retaddr:)
push 0 /* Fake retaddr, will crash if it returns. */
jmp GLOBAL_REF(precious) /* no return */
# ifdef X86
push 0 /* Fake retaddr, will crash if it returns. */
# endif
JUMP GLOBAL_REF(precious) /* no return. */
END_FUNC(precious_push_fake_retaddr)

END_FILE
Expand Down

0 comments on commit fa2475b

Please sign in to comment.