Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/usermode/usermode Adding an assert that checks for ...
details: https://anonhg.NetBSD.org/src/rev/9221f359a06a
branches: trunk
changeset: 780441:9221f359a06a
user: reinoud <reinoud%NetBSD.org@localhost>
date: Tue Jul 24 13:59:26 2012 +0000
description:
Adding an assert that checks for struct pmap_l2 not being bigger than
PAGE_SIZE.
While here, also add possible bug allerts of temporary mmaps that might screw
up memory.
diffstat:
sys/arch/usermode/usermode/pmap.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diffs (52 lines):
diff -r e763e4f93bb5 -r 9221f359a06a sys/arch/usermode/usermode/pmap.c
--- a/sys/arch/usermode/usermode/pmap.c Tue Jul 24 02:13:04 2012 +0000
+++ b/sys/arch/usermode/usermode/pmap.c Tue Jul 24 13:59:26 2012 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.103 2012/03/02 16:56:32 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.104 2012/07/24 13:59:26 reinoud Exp $ */
/*-
* Copyright (c) 2011 Reinoud Zandijk <reinoud%NetBSD.org@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.103 2012/03/02 16:56:32 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.104 2012/07/24 13:59:26 reinoud Exp $");
#include "opt_memsize.h"
#include "opt_kmempages.h"
@@ -204,6 +204,9 @@
if (TRAPSTACKSIZE < 4*PAGE_SIZE) {
panic("TRAPSTACKSIZE is too small, please increase UPAGES");
}
+ if (sizeof(struct pmap_l2) > PAGE_SIZE) {
+ panic("struct pmap_l2 bigger than one page?\n");
+ }
/* protect user memory UVM area (---) */
err = thunk_munmap((void *) kmem_user_start,
@@ -1202,6 +1205,7 @@
if (pa & (PAGE_SIZE-1))
panic("%s: unaligned address passed : %p\n", __func__, (void *) pa);
+ /* XXX bug alart: can we allow the kernel to make a decision on this? */
blob = thunk_mmap(NULL, PAGE_SIZE,
THUNK_PROT_READ | THUNK_PROT_WRITE,
THUNK_MAP_FILE | THUNK_MAP_SHARED,
@@ -1227,6 +1231,7 @@
thunk_printf_debug("pmap_copy_page: pa src %p, pa dst %p\n",
(void *) src_pa, (void *) dst_pa);
+ /* XXX bug alart: can we allow the kernel to make a decision on this? */
sblob = thunk_mmap(NULL, PAGE_SIZE,
THUNK_PROT_READ,
THUNK_MAP_FILE | THUNK_MAP_SHARED,
@@ -1234,6 +1239,7 @@
if (!sblob)
panic("%s: couldn't get src mapping", __func__);
+ /* XXX bug alart: can we allow the kernel to make a decision on this? */
dblob = thunk_mmap(NULL, PAGE_SIZE,
THUNK_PROT_READ | THUNK_PROT_WRITE,
THUNK_MAP_FILE | THUNK_MAP_SHARED,
Home |
Main Index |
Thread Index |
Old Index