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(',');
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "[email protected]"

Reply via email to