svn commit: r358109 - head/usr.bin/kdump

Kyle Evans kevans at FreeBSD.org
Wed Feb 19 14:32:57 UTC 2020


Author: kevans
Date: Wed Feb 19 14:32:55 2020
New Revision: 358109
URL: https://svnweb.freebsd.org/changeset/base/358109

Log:
  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

Modified:
  head/usr.bin/kdump/kdump.c

Modified: head/usr.bin/kdump/kdump.c
==============================================================================
--- head/usr.bin/kdump/kdump.c	Wed Feb 19 14:29:47 2020	(r358108)
+++ head/usr.bin/kdump/kdump.c	Wed Feb 19 14:32:55 2020	(r358109)
@@ -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(',');


More information about the svn-src-head mailing list