Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

caprevoke: Fix missing early-clobber in vm_do_cheri_revoke #2228

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions sys/arm64/arm64/cheri_revoke_machdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ vm_do_cheri_revoke(int *res, const struct vm_cheri_revoke_cookie *crc,
CHERI_REVOKE_STATS_BUMP(crst, caps_found_revoked);
} else if (cheri_gettag(cut) && ctp(crshadow, cut, perms, start, end)) {
void * __capability cscratch;
int stxr_status;
int stxr_status = 1;

uintcap_t cutr = cheri_revoke_cap(cut);

Expand All @@ -137,7 +137,6 @@ vm_do_cheri_revoke(int *res, const struct vm_cheri_revoke_cookie *crc,
*/

__asm__ __volatile__ (
"mov %w[stxr_status], #1\n\t"
#ifndef __CHERI_PURE_CAPABILITY__
"bx #4\n\t"
".arch_extension c64\n\t"
Expand All @@ -153,7 +152,7 @@ vm_do_cheri_revoke(int *res, const struct vm_cheri_revoke_cookie *crc,
".arch_extension noc64\n\t"
".arch_extension a64c\n\t"
#endif
: [stxr_status] "=r" (stxr_status),
: [stxr_status] "+&r" (stxr_status),
[cscratch] "=&C" (cscratch), [cutr] "+C" (cutr)
: [cut] "C" (cut), [cutp] "C" (cutp)
: "memory");
Expand Down
2 changes: 1 addition & 1 deletion sys/riscv/riscv/cheri_revoke_machdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,10 @@
"beq x0, %[ok], 1f\n\t"
"sc.c.cap %[cutr], (%[cutp])\n\t"
"1:\n\t"
: [ok] "=r" (ok), [cscratch] "=&C" (cscratch),
: [ok] "=&r" (ok), [cscratch] "=&C" (cscratch),
markjdb marked this conversation as resolved.
Show resolved Hide resolved
[cutr] "+C" (cutr)
: [cut] "C" (cut), [cutp] "C" (cutp)
: "memory");

Check warning on line 147 in sys/riscv/riscv/cheri_revoke_machdep.c

View workflow job for this annotation

GitHub Actions / Style Checker

Missing Signed-off-by: line

/* sc.c.cap clobbers its value operand with 0 on success */
if (__builtin_expect((uintcap_t)cutr == 0, 1)) {
Expand Down
Loading