[strace/strace] printsiginfo: decode si_pkey field (PR #210)
Slava
notifications at github.com
Thu Feb 3 20:14:18 UTC 2022
> I wonder whether the new code could be tested?
Behavior is different on different platforms. On platforms that have `pku` and `ospke` in `/proc/cpuinfo` this code would crash with `SIGSEGV` (and `si_pkey=1`) :
```
#define _GNU_SOURCE
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/mman.h>
#include <sys/prctl.h>
int main(void) {
prctl(PR_SET_DUMPABLE, 0);
int *buf = mmap(NULL, getpagesize(), PROT_EXEC, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
if (buf == MAP_FAILED) {
perror("mmap");
exit(EXIT_FAILURE);
}
if (*buf) {
asm volatile("":::"memory");
}
puts("PKU disabled, so it isn't crashed");
}
```
while on other platforms it will succeed (since these allow read access to `PROT_EXEC` regions).
I can try to make conditional test, that would be executed only of `pku` is present in `/proc/cpuinfo`.
--
Reply to this email directly or view it on GitHub:
https://github.com/strace/strace/pull/210#issuecomment-1029361480
You are receiving this because you are subscribed to this thread.
Message ID: <strace/strace/pull/210/c1029361480 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20220203/8c507ad9/attachment.htm>
More information about the Strace-devel
mailing list