-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathevm-kernel-fix1.patch
More file actions
36 lines (31 loc) · 1.52 KB
/
evm-kernel-fix1.patch
File metadata and controls
36 lines (31 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From 14b71ebe33a1f988187b722b450414f936912ab0 Mon Sep 17 00:00:00 2001
From: NSKernel <zhao.3289@osu.edu>
Date: Tue, 17 May 2022 05:10:26 +0800
Subject: [PATCH] Fixed clflush uaccess problem
---
kernel/emusgx/switchless_sync.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/kernel/emusgx/switchless_sync.c b/kernel/emusgx/switchless_sync.c
index 9e426758b..43e284fc4 100644
--- a/kernel/emusgx/switchless_sync.c
+++ b/kernel/emusgx/switchless_sync.c
@@ -326,7 +326,9 @@ int _enclave_local emusgx_switchless_new_slot(void *addr, void *page_data, struc
// the page is already flushed from the switchless syncing list
// Unmap the original addr from the memory to stop any writing to the page
+ __uaccess_begin();
clflush_cache_range(emusgx_switchless_pages[index].addr, 4096);
+ __uaccess_end();
// For some weird reason the mapped page is not the same as what we allocated
// So we will be using get_user_pages to get the real backing of the page
get_user_pages((unsigned long)emusgx_switchless_pages[index].addr, 1, 0, &in_kernel_page, NULL);
@@ -441,7 +443,9 @@ void _enclave_local emusgx_sync_all_pages(char print, char force_sync) {
}
if (emusgx_switchless_pages[i].status == EMUSGX_SWITCHLESS_SLOT_INUSE) {
+ __uaccess_begin();
clflush_cache_range(emusgx_switchless_pages[i].addr, 4096);
+ __uaccess_end();
get_user_pages((unsigned long)emusgx_switchless_pages[i].addr, 1, 0, &in_kernel_page, NULL);
emusgx_sync_on_dirty(i, in_kernel_page, force_sync);
if (unlikely(print)) {
--
2.25.1