signal: SIGSYS: decode si_syscall & si_arch fields
When receiving SIGSYS, the si_syscall & si_arch fields are set to known
values, so make sure we decode their values into the symbol settings.
This makes stracing seccomp failures much easier.
* defs.h (syscall_name): New prototype.
* printsiginfo.c: Include linux/audit.h and xlat/audit_arch.h.
(print_si_info): Decode si_syscall & si_arch for SIGSYS.
* syscall.c (undefined_scno_name): Delete.
(syscall_name): New function.
(trace_syscall_entering): Change undefined_scno_name to syscall_name.
(trace_syscall_exiting): Likewise.
* xlat/audit_arch.in: New file.
diff --git a/syscall.c b/syscall.c
index 6aa1cd2..396a7dd 100644
--- a/syscall.c
+++ b/syscall.c
@@ -745,13 +745,17 @@
# define shuffle_scno(scno) ((long)(scno))
#endif
-static char*
-undefined_scno_name(struct tcb *tcp)
+const char *
+syscall_name(long scno)
{
static char buf[sizeof("syscall_%lu") + sizeof(long)*3];
- sprintf(buf, "syscall_%lu", shuffle_scno(tcp->scno));
- return buf;
+ if (SCNO_IS_VALID(scno))
+ return sysent[scno].sys_name;
+ else {
+ sprintf(buf, "syscall_%lu", shuffle_scno(scno));
+ return buf;
+ }
}
static long get_regs_error;
@@ -781,7 +785,7 @@
if (scno_good != 1)
tprints("????" /* anti-trigraph gap */ "(");
else if (tcp->qual_flg & UNDEFINED_SCNO)
- tprintf("%s(", undefined_scno_name(tcp));
+ tprintf("%s(", syscall_name(tcp->scno));
else
tprintf("%s(", tcp->s_ent->sys_name);
/*
@@ -843,7 +847,7 @@
printleader(tcp);
if (tcp->qual_flg & UNDEFINED_SCNO)
- tprintf("%s(", undefined_scno_name(tcp));
+ tprintf("%s(", syscall_name(tcp->scno));
else
tprintf("%s(", tcp->s_ent->sys_name);
if ((tcp->qual_flg & QUAL_RAW) && SEN_exit != tcp->s_ent->sen)
@@ -907,7 +911,7 @@
tcp->flags &= ~TCB_REPRINT;
printleader(tcp);
if (tcp->qual_flg & UNDEFINED_SCNO)
- tprintf("<... %s resumed> ", undefined_scno_name(tcp));
+ tprintf("<... %s resumed> ", syscall_name(tcp->scno));
else
tprintf("<... %s resumed> ", tcp->s_ent->sys_name);
}