lkml.org 
[lkml]   [2022]   [Jun]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 9/9] mm/mshare: Enable mshare region mapping across processes
Date
This patch enables propcesses that did not create the mshare region
to map the region using mmap().

Signed-off-by: Khalid Aziz <khalid.aziz@oracle.com>
---
mm/mshare.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/mm/mshare.c b/mm/mshare.c
index 2ec0e56ffd69..455b10ca0cdf 100644
--- a/mm/mshare.c
+++ b/mm/mshare.c
@@ -144,7 +144,21 @@ msharefs_mmap(struct file *file, struct vm_area_struct *vma)
* page table sharing
*/
if (new_mm->mmap_base != 0) {
- return -EINVAL;
+ /*
+ * Any mappings of mshare region must use exact same
+ * virtual addresses
+ */
+ if ((vma->vm_start != new_mm->mmap_base) ||
+ (new_mm->task_size != (vma->vm_end - vma->vm_start)))
+ return -EINVAL;
+
+ vma->vm_private_data = info;
+ /*
+ * mshare pages are shared pages that also share page table
+ */
+ vma->vm_flags |= (VM_SHARED_PT|VM_SHARED);
+ vma->vm_ops = &msharefs_vm_ops;
+ refcount_inc(&info->refcnt);
} else {
struct mm_struct *old_mm;
struct vm_area_struct *new_vma;
--
2.32.0
\
 
 \ /
  Last update: 2022-06-30 00:58    [W:0.374 / U:0.556 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site