 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"

             if (status != SGX_SUCCESS) {
                 if (enclave_error != NULL)
                     *enclave_error = error_aesm2api(status);
@@ -842,6 +845,13 @@
     }
 
     se_mutex_lock(&s_enclave_mutex);

 {
     se_mutex_lock(&s_device_mutex);
 
@@ -382,22 +385,38 @@
         }
         //The in-kernel driver does not do the base and size alignment. This is up to user mode to do it. 
         //Therefore enclave_size will be virtual_size*2. The unused region will be released by calling munmap later.
-        enclave_size = virtual_size*2;
+        //Don't do this for a forked enclave with provided |base_address|,
+        //because in this case |base_address| is the address of an existing
+        //enclave that is already aligned.
+        if (!base_address)
+        {
+            enclave_size = virtual_size*2;
+        }
     }
     else
     {
         hdevice_temp = s_hdevice;
     }
     
