From c19f57f3c2c6f992a22a158c941ac325090d8d43 Mon Sep 17 00:00:00 2001 From: Pengfei Xu Date: Fri, 7 Jul 2023 10:13:04 +0800 Subject: [PATCH] shstk_unlock_test.c: add unlock WRSS check point Signed-off-by: Pengfei Xu --- cet/shstk_unlock_test.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cet/shstk_unlock_test.c b/cet/shstk_unlock_test.c index 34d404d..2d4c643 100644 --- a/cet/shstk_unlock_test.c +++ b/cet/shstk_unlock_test.c @@ -129,11 +129,19 @@ long unlock_shstk(pid_t pid) } if (ptrace(PTRACE_ARCH_PRCTL, pid, ARCH_SHSTK_SHSTK, ARCH_SHSTK_UNLOCK)) { - printf("[FAIL]\tCan't unlock CET for %d task", pid); + printf("[FAIL]\tCan't unlock user SHSTK for child pid:%d", pid); err_num++; goto detach; } else { - printf("[PASS]\tUnlock CET successfully for pid:%d\n", pid); + printf("[PASS]\tUnlock SHSTK for child pid:%d\n", pid); + } + + if (ptrace(PTRACE_ARCH_PRCTL, pid, ARCH_SHSTK_WRSS, ARCH_SHSTK_UNLOCK)) { + printf("[FAIL]\tCan't unlock WRSS for child pid:%d", pid); + err_num++; + goto detach; + } else { + printf("[PASS]\tUnlock WRSS for child pid:%d\n", pid); } ret = ptrace(PTRACE_GETREGSET, pid, NT_X86_SHSTK, &iov_cet); @@ -279,7 +287,7 @@ int main(void) printf("[FAIL]\tCould not re-enable Shadow stack.\n"); err_num++; } else { - printf("[PASS]\tChild process re-enable ssp\n"); + printf("[PASS]\tChild process re-enable SHSTK\n"); } ret = ARCH_PRCTL(ARCH_SHSTK_STATUS, &feature);