 diff -Nur psw/urts/linux/urts.cpp psw/urts/linux/urts.cpp
 --- psw/urts/linux/urts.cpp
 +++ psw/urts/linux/urts.cpp
-@@ -29,21 +29,23 @@
+@@ -29,21 +29,24 @@
   *
   */
  
 -
 +#include "arch.h"
++#include "edmm_utility.h"
 +#include "enclave.h"
  #include "sgx_error.h"
  #include "sgx_urts.h"

 
     //Only true or false is valid
     if(TRUE != debug &&  FALSE != debug)
@@ -158,7 +187,10 @@
                                                           const uint32_t ex_features,
                                                           const void* ex_features_p[32])
 {

+    if (asylo_config->base_address && *asylo_config->base_address &&
+        asylo_config->enclave_size > 0)
+    {
+        int driver_type = SGX_DRIVER_UNKNOWN;
+        if (!get_driver_type(&driver_type))
+        {
+            SE_TRACE(SE_TRACE_ERROR, "Could not get driver typed\n");
+            return SGX_ERROR_NO_DEVICE;
+        }
+        // For in kernel driver, the enclave memory address still contains VMAs
+        // after fork() on the host, they need to be unmapped before reserving
+        // the enclave memory.
+        if (driver_type == SGX_DRIVER_IN_KERNEL
+            && munmap(*asylo_config->base_address, asylo_config->enclave_size) != 0)
+        {
+            return SGX_ERROR_MEMORY_MAP_CONFLICT;
+        }
+        void *reserved_address = mmap(*asylo_config->base_address,
+                                      asylo_config->enclave_size, PROT_NONE,
+                                      MAP_SHARED | MAP_ANONYMOUS, -1, 0);
