          if(*it == thread_id)
              return TRUE;
      return FALSE;
-@@ -252,9 +252,9 @@
+@@ -218,6 +224,8 @@
+     {
+         if (g_enclave_creator->is_EDMM_supported(enclave->get_enclave_id()) && !m_utility_thread && (enclave->get_dynamic_tcs_list_size() != 0))
+             m_utility_thread = trust_thread;
++        else if (!m_user_utility_thread)
++            m_user_utility_thread = trust_thread;
+         else
+             m_free_thread_vector.push_back(trust_thread);
+     }
+@@ -252,9 +260,9 @@
  {
      LockGuard lock(&m_thread_mutex);
  

+)
--- /dev/null
+++ sgx_sdk.bzl
@@ -0,0 +1,209 @@
+"""Build tools for supporting Intel's SDK."""
+
+load("@com_google_asylo_backend_provider//:enclave_info.bzl", "EnclaveInfo")

+    implementation = _sgx_enclave_configuration,
+    output_to_genfiles = True,
+    attrs = {
+        "prodid": attr.string(
+            default = "0",
+            doc = ("The enclave's ISV (Independent Software Vendor) assigned " +
+                   "Product ID"),
+        ),
+        "isvsvn": attr.string(
+            default = "0",
+            doc = ("The enclave's ISV (Independent Software Vendor) assigned " +
+                   "Security Version Number"),
+        ),
+        "stack_max_size": attr.string(
+            default = "0x40000",
+            doc = "The enclave's maximum stack size in bytes (4KB aligned)",
+        ),
+        "heap_max_size": attr.string(
+            default = "0x100000",
+            doc = "The enclave's maximum heap size in bytes (4KB aligned)",
+        ),
+        # 2 tcs are reserved by the framework, 10 are left for users.
+        "tcs_num": attr.string(
+            default = "12",
+            doc = ("The number of Thread Control Structures allocated for " +
+                   "the enclave"),
+        ),
+        "tcs_policy": attr.string(
+            default = "1",
+            doc = ("The TCS management policy (" +
+                   "0 - The TCS is bound to the untrusted thread, " +
+                   "1 - The TCS is unbound to the untrusted thread)"),
+        ),
+        # "1" for release enclaves.
+        "disable_debug": attr.string(
+            default = "0",
+            doc = ("Indicates whether launching the enclave in debug mode is " +
+                   "disabled"),
+        ),
+        "provision_key": attr.string(
+            default = "0",
+            doc = ("Indicates whether the enclave has access to the " +
+                   "Provisioning Key and the Provisioning Seal Key"),
+        ),
+        "misc_select": attr.string(
+            default = "0",
+            doc = "The desired Extended SSA frame feature (must be 0)",
+        ),
+        "misc_mask": attr.string(
+            default = "0xffffffff",
+            doc = "A mask indicating which bits in misc_select are enforced",
+        ),
+    },
+)
+
