Skip to content

Commit

Permalink
Make test try to toggle the speculation state.
Browse files Browse the repository at this point in the history
It looks like a very recent kernel update has made `PR_SET_SPECULATION_CTRL` succeed
when you try to change an immutable state to the state it currently has.
  • Loading branch information
rocallahan committed Jul 28, 2024
1 parent dd0fb2d commit 0f13ad5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/test/prctl_speculation_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ int main(void) {
PR_SPEC_ENABLE, 0, 0) &&
errno == EPERM);
}
} else if (ret & PR_SPEC_ENABLE) {
test_assert(-1 == prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_STORE_BYPASS,
PR_SPEC_DISABLE, 0, 0) &&
errno == ENXIO);
} else {
test_assert(-1 == prctl(PR_SET_SPECULATION_CTRL, PR_SPEC_STORE_BYPASS,
PR_SPEC_ENABLE, 0, 0) &&
Expand Down

0 comments on commit 0f13ad5

Please sign in to comment.