From 0f13ad5a7c307c7d685c0b2e6c1abf378d64f832 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Mon, 29 Jul 2024 10:57:25 +1200 Subject: [PATCH] Make test try to toggle the speculation state. 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. --- src/test/prctl_speculation_ctrl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/test/prctl_speculation_ctrl.c b/src/test/prctl_speculation_ctrl.c index c6e88fff34d..3c19e639265 100644 --- a/src/test/prctl_speculation_ctrl.c +++ b/src/test/prctl_speculation_ctrl.c @@ -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) &&