Skip to content

Commit

Permalink
allocator-test: fix trusted stack revocation probe
Browse files Browse the repository at this point in the history
Ensure that the compiler loads the to be revoked pointer into a register
prior to releasing the main thread.  Otherwise, there is a chance that
we never hold an unrevoked copy in the register file.

Embarrassing fix to
#422
  • Loading branch information
nwf committed Jan 21, 2025
1 parent effe3da commit 6bbbedc
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tests/allocator-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,12 @@ namespace
async([=]() {
int ptag, scratch;

// Tell the main thread to go
state = 0;

/*
* Busy spin, ensuring that our test pointer is in a register
* throughout, then get its tag.
* Release the main thread, then busy spin, ensuring that our
* test pointer is in a register throughout, then get its tag.
*/
__asm__ volatile("1:\n"
__asm__ volatile("csw zero, 0(%[state])\n"
"1:\n"
"clw %[scratch], 0(%[state])\n"
"beqz %[scratch], 1b\n"
"cgettag %[out], %[p]\n"
Expand Down

0 comments on commit 6bbbedc

Please sign in to comment.