Skip to content

Commit

Permalink
Merge pull request ish-app#1667 from kmeisthax/unaligned_cmpxchg8b_fault
Browse files Browse the repository at this point in the history
  • Loading branch information
tbodt authored Jan 4, 2022
2 parents 1c1be5c + 971d4f3 commit b74ec82
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions jit/gadgets-aarch64/memory.S
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ NAME(si_gadgets):
mov _xaddr, x19
ret

.global segfault_\type
segfault_\type:
ldr _addr, [_tlb, -TLB_entries+TLB_segfault_addr]
str _addr, [_cpu, CPU_segfault_addr]
Expand Down
11 changes: 11 additions & 0 deletions jit/gadgets-aarch64/misc.S
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,14 @@
.gadget_array cmpxchg
.gadget_array atomic_cmpxchg

.extern segfault_write

.gadget atomic_cmpxchg8b
#Test for alignment.
tst _addr, 0x7
b.ne 2f

#cmpxchg8b via aligned exclusive 8b load
write_prep 64, atomic_cmpxchg8b
mov w9, eax
bfi x9, xdx, 32, 32
Expand Down Expand Up @@ -115,6 +122,10 @@
gret 1
write_bullshit 64, atomic_cmpxchg8b

2: #All unaligned paths
b segfault_write


.gadget cmpxchg8b
write_prep 64, cmpxchg8b
mov w9, eax
Expand Down

0 comments on commit b74ec82

Please sign in to comment.