auditor

An aarch64 constant-time memory access auditing tool.
git clone git://git.ppad.tech/auditor.git
Log | Files | Refs | README | LICENSE

good.s (731B)


      1 ; good.s - Known-good assembly (stack/heap accesses only)
      2 ; Should produce no violations
      3 
      4 .section __TEXT,__text
      5 .globl _safe_function
      6 .p2align 2
      7 
      8 _safe_function:
      9     ; Stack frame setup
     10     stp x29, x30, [sp, #-16]!
     11     mov x29, sp
     12 
     13     ; Load from GHC stack pointer (x20)
     14     ldr x0, [x20, #8]
     15     ldr x1, [x20, #16]
     16 
     17     ; Store to GHC heap pointer (x21)
     18     str x0, [x21]
     19     str x1, [x21, #8]
     20 
     21     ; Load from hardware stack
     22     ldr x2, [sp, #24]
     23 
     24     ; PC-relative constant pool
     25     adrp x8, _constant@PAGE
     26     add x8, x8, _constant@PAGEOFF
     27     ldr x3, [x8]
     28 
     29     ; Store pair to stack
     30     stp x0, x1, [sp, #-32]!
     31 
     32     ; Load pair from stack
     33     ldp x4, x5, [sp], #32
     34 
     35     ; Frame teardown
     36     ldp x29, x30, [sp], #16
     37     ret