Skip to content

Commit

Permalink
arm64: Make stxr_status an input operand in vm_do_cheri_revoke()
Browse files Browse the repository at this point in the history
If the capability under test changes between the initial load (done to
clear the tag before storing it) and the load-link, the initial
comparison fails and the inline asm block is supposed to leave
stxr_status set to 2.  However, the lack of an input constraint meant
that the compiler simply elided the initialization of stxr_status, which
could lead to an infinite loop.

Thus, make stxr_status an input operand as well as an output operand.
  • Loading branch information
markjdb committed Apr 17, 2024
1 parent af5403b commit 09a0788
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sys/arm64/arm64/cheri_revoke_machdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ vm_do_cheri_revoke(int *res, const struct vm_cheri_revoke_cookie *crc,
#endif
: [stxr_status] "=r" (stxr_status),
[cscratch] "=&C" (cscratch), [cutr] "+C" (cutr)
: [cut] "C" (cut), [cutp] "C" (cutp)
: [cut] "C" (cut), [cutp] "C" (cutp), "r" (stxr_status),
: "memory");

/* stxr returns 0 on success */
Expand Down

0 comments on commit 09a0788

Please sign in to comment.