Skip to content

Commit

Permalink
treat EINVAL from prtace(ARCH_SHSTK_STATUS) as no kernel support for …
Browse files Browse the repository at this point in the history
…shstk
  • Loading branch information
rppt committed Nov 29, 2023
1 parent 405672f commit 8fad7b3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compel/arch/x86/src/lib/infect.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ static int get_task_xsave(pid_t pid, user_fpregs_struct_t *xsave)
unsigned long features = 0;

if (ptrace(PTRACE_ARCH_PRCTL, pid, (unsigned long)&features, ARCH_SHSTK_STATUS)) {
/* kernels that don't support shadow stack return -EINVAL */
if (errno == EINVAL)
return 0;

pr_perror("shstk: can't get shadow stack status for %d", pid);
return -1;
}
Expand Down

0 comments on commit 8fad7b3

Please sign in to comment.