From f13c84c12eb52c4183e9df0caf45787ea3ba05ac Mon Sep 17 00:00:00 2001
From: jD91mZM2 <me@krake.one>
Date: Fri, 14 Aug 2020 11:02:16 +0200
Subject: [PATCH] Add comment about why this doesn't work

---
 src/scheme/memory.rs | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/scheme/memory.rs b/src/scheme/memory.rs
index 0cd3553..07d30a5 100644
--- a/src/scheme/memory.rs
+++ b/src/scheme/memory.rs
@@ -178,6 +178,14 @@ impl Scheme for MemoryScheme {
     fn funmap3(&self, flags: usize, address: usize, size: usize) -> Result<usize> {
         let flags = u8::try_from(flags).ok().and_then(Flags::from_bits).expect("MemoryScheme::funmap3: bits contained bad flags");
 
+        // OH NO!! The `funmap` system call will unmap the grant by default, but
+        // we haven't necessarily created a grant with fmap, we may very well
+        // just have given the pointer of a physical region!
+        //
+        // This will fail!! Is this "abuse" of fmap bad? Do we keep the phys*
+        // functions instead? If no, how do we fix this? Do we make each kernel
+        // scheme responsible for clearing up the grants themselves?
+
         if flags.contains(Flags::MODE_PHYSICAL) {
             driver::inner_physfree(address, size)
         } else if flags.contains(Flags::MODE_PHYSMAP) {
-- 
GitLab