From 7263efe581f47822ee1cbfecaef14d31f176d6ef Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Wed, 3 Mar 2010 22:08:47 +0000 Subject: [PATCH] Override Fault() method for VM{Device,Null}Cache to prevent vm_soft_fault() from inserting a clean page, if a fault happens. VMNullCaches are used by the slab's memory manager -- all page faults in slab areas are serious bugs and we want to panic() immediately. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35748 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/system/kernel/vm/VMDeviceCache.cpp | 7 +++++++ src/system/kernel/vm/VMDeviceCache.h | 5 ++++- src/system/kernel/vm/VMNullCache.cpp | 9 ++++++++- src/system/kernel/vm/VMNullCache.h | 7 +++++-- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/system/kernel/vm/VMDeviceCache.cpp b/src/system/kernel/vm/VMDeviceCache.cpp index 8231461f3c..ef771bbc0b 100644 --- a/src/system/kernel/vm/VMDeviceCache.cpp +++ b/src/system/kernel/vm/VMDeviceCache.cpp @@ -41,3 +41,10 @@ VMDeviceCache::Write(off_t offset, const iovec *vecs, size_t count, // no place to write, this will cause the page daemon to skip this store return B_OK; } + + +status_t +VMDeviceCache::Fault(struct VMAddressSpace* addressSpace, off_t offset) +{ + return B_BAD_ADDRESS; +} diff --git a/src/system/kernel/vm/VMDeviceCache.h b/src/system/kernel/vm/VMDeviceCache.h index cb6b5f2e31..5090fa4f51 100644 --- a/src/system/kernel/vm/VMDeviceCache.h +++ b/src/system/kernel/vm/VMDeviceCache.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2008-2010, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2005-2007, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. * @@ -24,6 +24,9 @@ public: virtual status_t Write(off_t offset, const iovec *vecs, size_t count, uint32 flags, size_t *_numBytes); + virtual status_t Fault(struct VMAddressSpace* addressSpace, + off_t offset); + private: addr_t fBaseAddress; }; diff --git a/src/system/kernel/vm/VMNullCache.cpp b/src/system/kernel/vm/VMNullCache.cpp index 86079ff611..8e86cf36ac 100644 --- a/src/system/kernel/vm/VMNullCache.cpp +++ b/src/system/kernel/vm/VMNullCache.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2008, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2008-2010, Ingo Weinhold, ingo_weinhold@gmx.de. * Distributed under the terms of the MIT License. */ @@ -11,3 +11,10 @@ VMNullCache::Init(uint32 allocationFlags) { return VMCache::Init(CACHE_TYPE_NULL, allocationFlags); } + + +status_t +VMNullCache::Fault(struct VMAddressSpace* addressSpace, off_t offset) +{ + return B_BAD_ADDRESS; +} diff --git a/src/system/kernel/vm/VMNullCache.h b/src/system/kernel/vm/VMNullCache.h index 15c1a08364..5484876335 100644 --- a/src/system/kernel/vm/VMNullCache.h +++ b/src/system/kernel/vm/VMNullCache.h @@ -1,5 +1,5 @@ /* - * Copyright 2008-2009, Ingo Weinhold, ingo_weinhold@gmx.de. + * Copyright 2008-2010, Ingo Weinhold, ingo_weinhold@gmx.de. * Copyright 2005-2007, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. * @@ -15,7 +15,10 @@ class VMNullCache : public VMCache { public: - status_t Init(uint32 allocationFlags); + status_t Init(uint32 allocationFlags); + + virtual status_t Fault(struct VMAddressSpace* addressSpace, + off_t offset); };