Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/uvm Redo uvm_map_setattr() to never fail and remove the ...
details: https://anonhg.NetBSD.org/src/rev/807b02f4176f
branches: trunk
changeset: 772184:807b02f4176f
user: reinoud <reinoud%NetBSD.org@localhost>
date: Thu Dec 22 13:12:50 2011 +0000
description:
Redo uvm_map_setattr() to never fail and remove the possible panic. The
possibility of failure was a C&P error.
diffstat:
sys/uvm/uvm_extern.h | 4 ++--
sys/uvm/uvm_map.c | 30 ++++++++++--------------------
sys/uvm/uvm_mmap.c | 10 ++++------
3 files changed, 16 insertions(+), 28 deletions(-)
diffs (122 lines):
diff -r c5707e73cceb -r 807b02f4176f sys/uvm/uvm_extern.h
--- a/sys/uvm/uvm_extern.h Thu Dec 22 11:33:54 2011 +0000
+++ b/sys/uvm/uvm_extern.h Thu Dec 22 13:12:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_extern.h,v 1.177 2011/12/20 15:39:35 reinoud Exp $ */
+/* $NetBSD: uvm_extern.h,v 1.178 2011/12/22 13:12:50 reinoud Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -680,7 +680,7 @@
void uvm_whatis(uintptr_t, void (*)(const char *, ...));
-bool uvm_map_setattr(struct vm_map *, vaddr_t,
+void uvm_map_setattr(struct vm_map *, vaddr_t,
vaddr_t, uint32_t);
bool uvm_map_checkattr(struct vm_map *, vaddr_t,
vaddr_t, uint32_t);
diff -r c5707e73cceb -r 807b02f4176f sys/uvm/uvm_map.c
--- a/sys/uvm/uvm_map.c Thu Dec 22 11:33:54 2011 +0000
+++ b/sys/uvm/uvm_map.c Thu Dec 22 13:12:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_map.c,v 1.308 2011/12/20 15:39:35 reinoud Exp $ */
+/* $NetBSD: uvm_map.c,v 1.309 2011/12/22 13:12:50 reinoud Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.308 2011/12/20 15:39:35 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.309 2011/12/22 13:12:50 reinoud Exp $");
#include "opt_ddb.h"
#include "opt_uvmhist.h"
@@ -4127,38 +4127,28 @@
* => map must be read or write locked by caller.
*/
-bool
+void
uvm_map_setattr(struct vm_map *map, vaddr_t start, vaddr_t end,
uint32_t map_attrib)
{
struct vm_map_entry *entry;
struct vm_map_entry *tmp_entry;
- if (!uvm_map_lookup_entry(map, start, &tmp_entry)) {
- return (false);
- }
+ /* safety */
+ if (!uvm_map_lookup_entry(map, start, &tmp_entry))
+ return;
entry = tmp_entry;
while (start < end) {
- if (entry == &map->header) {
- return (false);
- }
-
- /*
- * no holes allowed
- */
-
- if (start < entry->start) {
- return (false);
- }
-
/* set attributes associated with entry */
-
entry->map_attrib = map_attrib;
+ /* empty one */
+ if (entry == &map->header)
+ return;
+
start = entry->end;
entry = entry->next;
}
- return (true);
}
/*
diff -r c5707e73cceb -r 807b02f4176f sys/uvm/uvm_mmap.c
--- a/sys/uvm/uvm_mmap.c Thu Dec 22 11:33:54 2011 +0000
+++ b/sys/uvm/uvm_mmap.c Thu Dec 22 13:12:50 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_mmap.c,v 1.141 2011/12/20 19:49:36 reinoud Exp $ */
+/* $NetBSD: uvm_mmap.c,v 1.142 2011/12/22 13:12:50 reinoud Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.141 2011/12/20 19:49:36 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.142 2011/12/22 13:12:50 reinoud Exp $");
#include "opt_compat_netbsd.h"
#include "opt_pax.h"
@@ -554,10 +554,9 @@
*/
if (error == 0) {
if (flags & MAP_ATTRIB_MASK) {
- if (!uvm_map_setattr(&p->p_vmspace->vm_map,
+ uvm_map_setattr(&p->p_vmspace->vm_map,
addr, addr + size,
- flags & MAP_ATTRIB_MASK))
- panic("uvm_setattr failed?");
+ flags & MAP_ATTRIB_MASK);
}
/* record if we need optimization for system call checking */
if ((flags & MAP_NOSYSCALLS) &&
@@ -567,7 +566,6 @@
mutex_exit(p->p_lock);
}
}
-
if (fp != NULL)
fd_putfile(fd);
Home |
Main Index |
Thread Index |
Old Index