From 7cac787bee275cd66efbe26cbbd0207fac3c1969 Mon Sep 17 00:00:00 2001 From: John Dyson Date: Sun, 20 Apr 1997 17:12:11 +0000 Subject: [PATCH] Fix both a problem with accessing backing objects, and also release the process map on nonexistant pages. PR: kern/3327 Submitted by: Tor Egge --- sys/fs/procfs/procfs_mem.c | 15 ++++++++++++++- sys/miscfs/procfs/procfs_mem.c | 15 ++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/sys/fs/procfs/procfs_mem.c b/sys/fs/procfs/procfs_mem.c index a354a66c526..ef049bd700d 100644 --- a/sys/fs/procfs/procfs_mem.c +++ b/sys/fs/procfs/procfs_mem.c @@ -37,7 +37,7 @@ * * @(#)procfs_mem.c 8.5 (Berkeley) 6/15/94 * - * $Id: procfs_mem.c,v 1.23 1997/02/22 09:40:28 peter Exp $ + * $Id: procfs_mem.c,v 1.24 1997/04/06 02:29:31 dyson Exp $ */ /* @@ -197,6 +197,17 @@ procfs_rwmem(p, uio) } m = vm_page_lookup(object, pindex); + + /* Allow fallback to backing objects if we are reading */ + + while (m == NULL && !writing && object->backing_object) { + + pindex += OFF_TO_IDX(object->backing_object_offset); + object = object->backing_object; + + m = vm_page_lookup(object, pindex); + } + if (m == NULL) { error = EFAULT; @@ -206,6 +217,8 @@ procfs_rwmem(p, uio) */ object = NULL; + vm_map_lookup_done(tmap, out_entry); + break; } diff --git a/sys/miscfs/procfs/procfs_mem.c b/sys/miscfs/procfs/procfs_mem.c index a354a66c526..ef049bd700d 100644 --- a/sys/miscfs/procfs/procfs_mem.c +++ b/sys/miscfs/procfs/procfs_mem.c @@ -37,7 +37,7 @@ * * @(#)procfs_mem.c 8.5 (Berkeley) 6/15/94 * - * $Id: procfs_mem.c,v 1.23 1997/02/22 09:40:28 peter Exp $ + * $Id: procfs_mem.c,v 1.24 1997/04/06 02:29:31 dyson Exp $ */ /* @@ -197,6 +197,17 @@ procfs_rwmem(p, uio) } m = vm_page_lookup(object, pindex); + + /* Allow fallback to backing objects if we are reading */ + + while (m == NULL && !writing && object->backing_object) { + + pindex += OFF_TO_IDX(object->backing_object_offset); + object = object->backing_object; + + m = vm_page_lookup(object, pindex); + } + if (m == NULL) { error = EFAULT; @@ -206,6 +217,8 @@ procfs_rwmem(p, uio) */ object = NULL; + vm_map_lookup_done(tmap, out_entry); + break; }