[strace/strace] printsiginfo: decode si_pkey field (PR #210)

Dmitry V. Levin notifications at github.com
Thu Feb 3 15:48:25 UTC 2022


@ldv-alt requested changes on this pull request.

commit message: please change
```
* src/printsiginfo.c: decode si_pkey field.
```
to
```
* src/printsiginfo.c (print_si_info) [HAVE_SIGINFO_T_SI_PKEY]: Decode
si_pkey field.
```

> @@ -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

Please make sure each sentence ends with a dot.

If you have a look at the NEWS file, you'll see that almost every
"Improvements" section ends with "Updated lists of constants" line followed by
"Updated lists of ioctl commands" line.
Let's keep this tradition, please add your line before rather than after
these lines.

>  		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);

Apparently, siginfo_t.si_pkey is not the only field that could be printed in case of SIGSEGV or SIGBUS,
so I'd suggest to separate `case SIGSEG` and `case SIGBUS`, and use a `switch` on `sip->si_code` instead of an `if` statement.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/strace/strace/pull/210#pullrequestreview-872028068
You are receiving this because you are subscribed to this thread.

Message ID: <strace/strace/pull/210/review/872028068 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20220203/3af14507/attachment.htm>


More information about the Strace-devel mailing list