From 21a8ddd458f8d6d13d9b57afcf409103bc30b6eb Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Tue, 6 Apr 2021 09:08:03 +0800 Subject: [PATCH] kernel: services: don't remap memory on intra-process lends This brings intra-process lending in-line with intra-process sending, where memory is not remapped the pointer is simply reused. We may change this at a later point in order to further enforce the concept of lent-memory-is-inaccessible, so do not rely in this behavior. Signed-off-by: Sean Cross --- kernel/src/services.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/src/services.rs b/kernel/src/services.rs index 97e402d03..4900be416 100644 --- a/kernel/src/services.rs +++ b/kernel/src/services.rs @@ -1147,6 +1147,10 @@ impl SystemServices { } let current_pid = self.current_pid(); + // If it's within the same process, ignore the operation. + if current_pid == dest_pid { + return Ok(src_virt); + } let src_mapping = self.get_process(current_pid)?.mapping; let dest_mapping = self.get_process(dest_pid)?.mapping; use crate::mem::MemoryManager;