Skip to content

Commit

Permalink
printsiginfo: decode si_pkey field
Browse files Browse the repository at this point in the history
This adds decoding of si_pkey field  which is set on SIGSEGV in case
of memory access violation on some modern CPUs (these have pku flag in
/proc/cpuinfo).

* NEWS: Mention this change.
* configure.ac (AC_CHECK_MEMBERS): Check for siginfo_t.si_pkey
* src/printsiginfo.c: decode si_pkey field.
  • Loading branch information
bacher09 committed Feb 2, 2022
1 parent dadd6b4 commit f98f197
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -12,6 +12,7 @@ Noteworthy changes in release ?.?? (????-??-??)
* Implemented decoding of PR_SET_VMA operation of prctl syscall.
* Updated lists of FAN_*, IORING_*, IOSQE_*, KVM_*, MODULE_INIT_*, TCA_ACT_*,
and *_MAGIC constants.
* Add decoding of si_pkey field in siginfo struct

* Bug fixes

Expand Down
3 changes: 2 additions & 1 deletion configure.ac
Expand Up @@ -423,7 +423,8 @@ AC_CHECK_MEMBERS([struct utsname.domainname],,, [#include <sys/utsname.h>])
AC_CHECK_MEMBERS(m4_normalize([
siginfo_t.si_syscall,
siginfo_t.si_timerid,
siginfo_t.si_overrun
siginfo_t.si_overrun,
siginfo_t.si_pkey
]),,, [#include <signal.h>])

AC_CHECK_HEADERS(m4_normalize([
Expand Down
6 changes: 6 additions & 0 deletions src/printsiginfo.c
Expand Up @@ -165,6 +165,12 @@ print_si_info(struct tcb *tcp, const siginfo_t *sip)
case SIGSEGV: case SIGBUS:
tprint_struct_next();
PRINT_FIELD_PTR(*sip, si_addr);
#ifdef HAVE_SIGINFO_T_SI_PKEY
if (sip->si_signo == SIGSEGV && sip->si_code == SEGV_PKUERR) {
tprint_struct_next();
PRINT_FIELD_D(*sip, si_pkey);
}
#endif
break;
case SIGPOLL:
switch (sip->si_code) {
Expand Down

0 comments on commit f98f197

Please sign in to comment.