diff options
author | Eugene Syromyatnikov <evgsyr@gmail.com> | 2021-10-11 21:12:00 +0200 |
---|---|---|
committer | Eugene Syromyatnikov <evgsyr@gmail.com> | 2021-10-12 00:36:15 +0200 |
commit | f21601cc93a7ebba74683541f33e83bd92c4d8f0 (patch) | |
tree | 891fc6a9d47b2e6b5d6e8d03b06dc1e9ab66d49b | |
parent | 3b5f7f1f42f1e71a5ddd5262c9a5a9476a44900e (diff) | |
download | strace-f21601cc93a7ebba74683541f33e83bd92c4d8f0.tar.gz |
prctl: handle PR_SPEC_L1D_FLUSH PR_[GS]ET_SPECULATION_CTRL prctl sub-command
* src/xlat/pr_spec_cmds.in (PR_SPEC_L1D_FLUSH): New constant, introduced
by Linux commit v5.15-rc1~193^2~1.
* src/prctl.c (SYS_FUNC(prctl)) <case PR_GET_SPECULATION_CTRL,
case PR_SET_SPECULATION_CTRL>: Handle PR_SPEC_L1D_FLUSH in arg2.
* tests/prctl-spec-inject.c (prctl-spec-inject): Adjust expected
"-a" option value.
* tests/prctl-spec-inject.c: Update expected output.
-rw-r--r-- | src/prctl.c | 2 | ||||
-rw-r--r-- | src/xlat/pr_spec_cmds.in | 1 | ||||
-rw-r--r-- | tests/gen_tests.in | 2 | ||||
-rw-r--r-- | tests/prctl-spec-inject.c | 9 |
4 files changed, 9 insertions, 5 deletions
diff --git a/src/prctl.c b/src/prctl.c index 0d44b5fd7..4275e5f70 100644 --- a/src/prctl.c +++ b/src/prctl.c @@ -264,6 +264,7 @@ SYS_FUNC(prctl) switch (arg2) { case PR_SPEC_STORE_BYPASS: case PR_SPEC_INDIRECT_BRANCH: + case PR_SPEC_L1D_FLUSH: tcp->auxstr = sprintflags_ex("", pr_spec_get_store_bypass_flags, (kernel_ulong_t) tcp->u_rval, '\0', @@ -464,6 +465,7 @@ SYS_FUNC(prctl) switch (arg2) { case PR_SPEC_STORE_BYPASS: case PR_SPEC_INDIRECT_BRANCH: + case PR_SPEC_L1D_FLUSH: printxval64(pr_spec_set_store_bypass_flags, arg3, "PR_SPEC_???"); break; diff --git a/src/xlat/pr_spec_cmds.in b/src/xlat/pr_spec_cmds.in index 8e5ded0b3..5d85f5e36 100644 --- a/src/xlat/pr_spec_cmds.in +++ b/src/xlat/pr_spec_cmds.in @@ -1,3 +1,4 @@ #value_indexed PR_SPEC_STORE_BYPASS 0 PR_SPEC_INDIRECT_BRANCH 1 +PR_SPEC_L1D_FLUSH 2 diff --git a/tests/gen_tests.in b/tests/gen_tests.in index b3578eb18..30a520e68 100644 --- a/tests/gen_tests.in +++ b/tests/gen_tests.in @@ -647,7 +647,7 @@ prctl-set-ptracer-success--pidns-translation check_scno_tampering; test_pidns - prctl-set-ptracer-success-Xabbrev--pidns-translation check_scno_tampering; test_pidns -einject=prctl:when=256+:retval=0 -etrace=prctl -a31 "QUIRK:START-OF-TEST-OUTPUT:prctl(0xffffffff /* PR_??? */, 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xfffffffb)" -Xabbrev prctl-set-ptracer-success-Xraw--pidns-translation check_scno_tampering; test_pidns -einject=prctl:when=256+:retval=0 -etrace=prctl -a27 "QUIRK:START-OF-TEST-OUTPUT:prctl(0xffffffff, 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xfffffffb)" -Xraw prctl-set-ptracer-success-Xverbose--pidns-translation check_scno_tampering; test_pidns -einject=prctl:when=256+:retval=0 -etrace=prctl -a48 "QUIRK:START-OF-TEST-OUTPUT:prctl(0xffffffff /* PR_??? */, 0xfffffffe, 0xfffffffd, 0xfffffffc, 0xfffffffb)" -Xverbose -prctl-spec-inject +prctl-success.sh PRCTL_INJECT_RETVALS="error=ENOTTY 0 1 3 8 16 32 42" -a53 +prctl-spec-inject +prctl-success.sh PRCTL_INJECT_RETVALS="error=ENOTTY 0 1 3 8 16 32 42" -a50 prctl-sve +prctl.sh -a21 prctl-syscall-user-dispatch +prctl.sh -a68 prctl-tagged-addr +prctl.sh -a43 diff --git a/tests/prctl-spec-inject.c b/tests/prctl-spec-inject.c index 598467f4d..4a351a96c 100644 --- a/tests/prctl-spec-inject.c +++ b/tests/prctl-spec-inject.c @@ -46,6 +46,7 @@ main(int argc, char **argv) } spec_strs[] = { { 0, "PR_SPEC_STORE_BYPASS" }, { 1, "PR_SPEC_INDIRECT_BRANCH" }, + { 2, "PR_SPEC_L1D_FLUSH" }, }; static const struct { @@ -104,8 +105,8 @@ main(int argc, char **argv) ", -5) returning %ld", injected_val); /* PR_GET_SPECULATION_CTRL */ - rc = do_prctl(52, 2, bogus_arg3); - printf("prctl(PR_GET_SPECULATION_CTRL, 0x2 /* PR_SPEC_??? */) " + rc = do_prctl(52, 3, bogus_arg3); + printf("prctl(PR_GET_SPECULATION_CTRL, 0x3 /* PR_SPEC_??? */) " "= %s (INJECTED)\n", sprintrc(rc)); rc = do_prctl(52, bogus_arg2, bogus_arg3); @@ -138,8 +139,8 @@ main(int argc, char **argv) /* PR_SET_SPECULATION_CTRL*/ - rc = do_prctl(53, 2, bogus_arg3); - printf("prctl(PR_SET_SPECULATION_CTRL, 0x2 /* PR_SPEC_??? */, %#llx) " + rc = do_prctl(53, 3, bogus_arg3); + printf("prctl(PR_SET_SPECULATION_CTRL, 0x3 /* PR_SPEC_??? */, %#llx) " "= %s (INJECTED)\n", (unsigned long long) bogus_arg3, sprintrc(rc)); |