kdump: decode SHM_ANON as first arg to legacy shm_open(2)

The first argument to shm_open(2) as well as shm_open2(2) may be a path or
SHM_ANON. Decode SHM_ANON, at least- paths will show up as namei results in
kdump output, which may be sufficient; in those cases, we'll have printed an
address.

Future commits will add support for shm_open2() to libsysdecode/truss/kdump.

Reported by:	kaktus
MFC after:	3 days
This commit is contained in:
kevans 2020-02-19 14:32:55 +00:00
parent b06aa6ced2
commit ac0f95fa20

View File

@ -55,6 +55,7 @@ __FBSDID("$FreeBSD$");
#include <sys/uio.h>
#include <sys/event.h>
#include <sys/ktrace.h>
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/stat.h>
@ -1248,7 +1249,12 @@ ktrsyscall(struct ktr_syscall *ktr, u_int sv_flags)
break;
#ifdef SYS_freebsd12_shm_open
case SYS_freebsd12_shm_open:
print_number(ip, narg, c);
if (ip[0] == (uintptr_t)SHM_ANON) {
printf("(SHM_ANON");
ip++;
} else {
print_number(ip, narg, c);
}
putchar(',');
print_mask_arg(sysdecode_open_flags, ip[0]);
putchar(',');