DragonFlyBSD Kernel Audit
DF-0921 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/vfs/procfs/procfs_map.c b/sys/vfs/procfs/procfs_map.c
--- a/sys/vfs/procfs/procfs_map.c
+++ b/sys/vfs/procfs/procfs_map.c
@@ -70,6 +70,16 @@
 	if (uio->uio_rw != UIO_READ)
 		return (EOPNOTSUPP);
 
+	/*
+	 * The map file discloses the full VM address layout and mapped
+	 * file paths of the target process.  Apply the same
+	 * CHECKIO / p_trespass authorization that procfs_doregs(),
+	 * procfs_dofpregs(), procfs_dodbregs(), procfs_domem() and
+	 * procfs_open() (case Pmem) all enforce at entry.
+	 */
+	if (!CHECKIO(curp, p) || p_trespass(curp->p_ucred, p->p_ucred))
+		return (EPERM);
+
 	error = 0;
 
 	if (uio->uio_offset < 0 || uio->uio_resid < 0 || buflen >= INT_MAX)