svn commit: r352913 - head/lib/libsysdecode

Pawel Biernacki kaktus at FreeBSD.org
Mon Sep 30 19:03:43 UTC 2019


Author: kaktus
Date: Mon Sep 30 19:03:43 2019
New Revision: 352913
URL: https://svnweb.freebsd.org/changeset/base/352913

Log:
  libsysdecode: decode PROT_MAX flags
  
  Extend libsysdecode to pretty-print PROT_MAX flags and fix decoding of regular protection flags broken since r349240.
  
  before:
  truss:
  mmap(0x0,40960,0x30000,MAP_PRIVATE|MAP_ANON|MAP_NOCORE,-1,0x0) = 34366234624 (0x800632000)
  kdump:
  11439 protmax  CALL  mmap(0,0xa000,0x30000<><invalid>196608,0x21002<MAP_PRIVATE|MAP_ANON|MAP_NOCORE>,0xffffffff,0)
  
  after:
  truss:
  mmap(0x0,40960,PROT_MAX(PROT_READ|PROT_WRITE)|PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_NOCORE,-1,0x0) = 34366234624 (0x800632000)
  kdump:
  11439 protmax  CALL  mmap(0,0xa000,0x30000<PROT_MAX(PROT_READ|PROT_WRITE)|PROT_READ|PROT_WRITE>,0x21002<MAP_PRIVATE|MAP_ANON|MAP_NOCORE>,0xffffffff,0)
  
  Reviewed by:	kib (mentor)
  Approved by:	kib (mentor)
  Differential Revision:	https://reviews.freebsd.org/D21706

Modified:
  head/lib/libsysdecode/flags.c

Modified: head/lib/libsysdecode/flags.c
==============================================================================
--- head/lib/libsysdecode/flags.c	Mon Sep 30 18:22:33 2019	(r352912)
+++ head/lib/libsysdecode/flags.c	Mon Sep 30 19:03:43 2019	(r352913)
@@ -657,8 +657,18 @@ sysdecode_mlockall_flags(FILE *fp, int flags, int *rem
 bool
 sysdecode_mmap_prot(FILE *fp, int prot, int *rem)
 {
+	int protm;
+	bool printed;
 
-	return (print_mask_int(fp, mmapprot, prot, rem));
+	printed = false;
+	protm = PROT_MAX_EXTRACT(prot);
+	if (protm != 0) {
+		fputs("PROT_MAX(", fp);
+		printed = print_mask_int(fp, mmapprot, protm, rem);
+		fputs(")|", fp);
+		prot = protm;
+	}
+	return (print_mask_int(fp, mmapprot, prot, rem) || printed);
 }
 
 bool


More information about the svn-src-head mailing list