Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Jan 2020 16:00:28 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r356794 - stable/12/sys/compat/linprocfs
Message-ID:  <202001161600.00GG0SwB040030@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Thu Jan 16 16:00:28 2020
New Revision: 356794
URL: https://svnweb.freebsd.org/changeset/base/356794

Log:
  MFC r356494:
  
  PR:	240992

Modified:
  stable/12/sys/compat/linprocfs/linprocfs.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/compat/linprocfs/linprocfs.c
==============================================================================
--- stable/12/sys/compat/linprocfs/linprocfs.c	Thu Jan 16 15:33:54 2020	(r356793)
+++ stable/12/sys/compat/linprocfs/linprocfs.c	Thu Jan 16 16:00:28 2020	(r356794)
@@ -1073,7 +1073,7 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
 	vm_map_entry_t entry, tmp_entry;
 	vm_object_t obj, tobj, lobj;
 	vm_offset_t e_start, e_end;
-	vm_ooffset_t off = 0;
+	vm_ooffset_t off;
 	vm_prot_t e_prot;
 	unsigned int last_timestamp;
 	char *name = "", *freename = NULL;
@@ -1083,6 +1083,7 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
 	int error;
 	struct vnode *vp;
 	struct vattr vat;
+	bool private;
 
 	PROC_LOCK(p);
 	error = p_candebug(td, p);
@@ -1114,17 +1115,21 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
 		e_start = entry->start;
 		e_end = entry->end;
 		obj = entry->object.vm_object;
-		for (lobj = tobj = obj; tobj; tobj = tobj->backing_object) {
+		off = entry->offset;
+		for (lobj = tobj = obj; tobj != NULL;
+		    lobj = tobj, tobj = tobj->backing_object) {
 			VM_OBJECT_RLOCK(tobj);
+			off += lobj->backing_object_offset;
 			if (lobj != obj)
 				VM_OBJECT_RUNLOCK(lobj);
-			lobj = tobj;
 		}
+		private = (entry->eflags & MAP_ENTRY_COW) != 0 || obj == NULL ||
+		    ((obj->type == OBJT_DEFAULT || obj->type == OBJT_SWAP) &&
+		    (obj->flags & OBJ_NOSPLIT) == 0);
 		last_timestamp = map->timestamp;
 		vm_map_unlock_read(map);
 		ino = 0;
 		if (lobj) {
-			off = IDX_TO_OFF(lobj->size);
 			vp = vm_object_vnode(lobj);
 			if (vp != NULL)
 				vref(vp);
@@ -1161,7 +1166,7 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
 		    (e_prot & VM_PROT_READ)?"r":"-",
 		    (e_prot & VM_PROT_WRITE)?"w":"-",
 		    (e_prot & VM_PROT_EXECUTE)?"x":"-",
-		    "p",
+		    private ? "p" : "s",
 		    (u_long)off,
 		    0,
 		    0,



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