Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Feb 2020 14:32:55 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r358109 - head/usr.bin/kdump
Message-ID:  <202002191432.01JEWttF091411@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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(',');



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002191432.01JEWttF091411>