Browse Source

More fixes

Don Porter 7 years ago
parent
commit
64a4804cd2

+ 0 - 47
LibOS/shim/test/apps/Makefile

@@ -1,47 +0,0 @@
-SYS ?= $(shell gcc -dumpmachine)
-export SYS
-
-apps = lmbench gcc busybox lighttpd bash apache make python r openjdk
-packed_apps = lmbench
-
-target = pal pal_sec
-clean-extra = clean-all
-
-level = ../
-include ../Makefile
-
-ifeq ($(SYS),x86_64-linux-gnu)
-HOSTDIR =
-PAL = $(abspath $(PWD)/../pal_loader)
-else
-HOSTDIR = /tmp/host
-PAL = $(abspath $(PWD)/../pal)
-endif
-
-manifest_rules = \
-	-e 's:\$$(PAL):$(PAL):g' \
-	-e 's:\$$(PWD):$(PWD)/:g' \
-	-e 's:\$$(BIN):$(subst .manifest,,$(notdir $@)):g' \
-	-e 's:\$$(SHIMPATH):$(abspath ../../src/libsysdb.so):g' \
-	-e 's:\$$(GLIBCDIR):$(abspath $(glibc_dir))/:g' \
-	-e 's:\$$(HOSTDIR):$(HOSTDIR):g' \
-	$(extra_rules)
-
-%.manifest: %.manifest.template
-	sed $(manifest_rules) $< >$@
-	chmod +x $@
-
-ifeq ($(SYS),x86_64-linux-gnu)
-build-all:
-	for f in $(apps); do (cd $$f; $(MAKE) $(DEBUG) || true; cd ..); done
-
-.PHONY: pack
-pack:
-	for f in $(packed_apps); do (cd $$f; $(MAKE) pack; cd ..); done
-else
-build-all:
-	for f in $(packed_apps); do (cd $$f; $(MAKE) || true; cd ..); done
-endif
-
-clean-all:
-	for f in $(apps); do (cd $$f; $(MAKE) clean; cd ..); done

+ 1 - 1
LibOS/shim/test/regression/large-mmap.manifest.template

@@ -21,4 +21,4 @@ sgx.trusted_files.libc = file:../../../../Runtime/libc.so.6
 
 sgx.allowed_files.testfile = file:testfile
 
-sgx.enclave_size = 5G
+sgx.enclave_size = 8G

+ 1 - 1
Pal/src/host/Linux-SGX/Makefile

@@ -28,7 +28,7 @@ endif
 ../../host_endian.h: host_endian.h
 	$(MAKE) -C ../../ $<
 
-libpal-Linux-SGX.a: $(addsuffix .o,$(enclave-objs) $(enclave-asm-objs)) $(graphene_lib)
+libpal-Linux-SGX.a: $(addsuffix .o,$(enclave-objs) $(enclave-asm-objs))
 	@echo [ host/Linux-SGX/$@ ]
 	$(AR) $(ARFLAGS) $@ $^
 

+ 1 - 0
Pal/src/host/Linux-SGX/Makefile.am

@@ -22,3 +22,4 @@ pal_lib = libpal-enclave.so
 pal_lib_deps = $(HOST_DIR)/enclave.lds $(HOST_DIR)/pal.map
 pal_lib_post = libpal.so
 pal_static = libpal.a
+pal_gdb = $(HOST_DIR)/debugger/gdb

+ 23 - 17
Pal/src/host/Linux-SGX/sgx_main.c

@@ -916,30 +916,36 @@ int main (int argc, const char ** argv, const char ** envp)
     INLINE_SYSCALL(read, 3, fd, filebuf, 4);
     INLINE_SYSCALL(close, 1, fd);
 
+    char sgx_manifest[URI_MAX];
+    int len = get_base_name(exec_uri + static_strlen("file:"), sgx_manifest,
+                            URI_MAX);
+    if (len < 0)
+        return len;
+
+    if (strcmp_static(sgx_manifest + len - strlen(".manifest"), ".manifest")) {
+        strcpy_static(sgx_manifest + len, ".sgx", URI_MAX - len);
+    } else if (!strcmp_static(sgx_manifest + len - strlen(".manifest.sgx"),
+                              ".manifest.sgx")) {
+        strcpy_static(sgx_manifest + len, ".manifest.sgx", URI_MAX - len);
+    }
+
     if (memcmp(filebuf, "\177ELF", 4)) {
         manifest_uri = exec_uri;
         exec_uri = NULL;
-        SGX_DBG(DBG_I, "manifest file: %s\n", manifest_uri);
-    } else {
-        char path[URI_MAX];
-        int len = get_base_name(exec_uri + static_strlen("file:"),
-                                path, URI_MAX);
-        if (len < 0)
-            return len;
-
-        strcpy_static(path + len, ".manifest.sgx", URI_MAX - len);
-
-        fd = INLINE_SYSCALL(open, 3, path, O_RDONLY|O_CLOEXEC, 0);
-        if (IS_ERR(fd)) {
-            SGX_DBG(DBG_E, "cannot open manifest file: %s\n", path);
-            goto usage;
-        }
+    }
 
-        manifest_uri = alloc_concat("file:", static_strlen("file:"), path, -1);
+    fd = INLINE_SYSCALL(open, 3, sgx_manifest, O_RDONLY|O_CLOEXEC, 0);
+    if (!IS_ERR(fd)) {
+        manifest_uri = alloc_concat("file:", static_strlen("file:"),
+                                    sgx_manifest, -1);
         INLINE_SYSCALL(close, 1, fd);
-        SGX_DBG(DBG_I, "manifest file: %s\n", manifest_uri);
+    } else if (!manifest_uri) {
+        SGX_DBG(DBG_E, "cannot open manifest file: %s\n", sgx_manifest);
+        goto usage;
     }
 
+    SGX_DBG(DBG_I, "manifest file: %s\n", manifest_uri);
+
     return load_enclave(enclave, manifest_uri, exec_uri, argv, envp);
 
 usage: