Browse Source

Merge branch 'master' of git://github.com/woonhak/graphene into woonhak-master

Don Porter 8 years ago
parent
commit
2ce5803616

+ 14 - 11
LibOS/shim/src/sys/shim_socket.c

@@ -450,13 +450,14 @@ int shim_do_bind (int sockfd, struct sockaddr * addr, socklen_t addrlen)
         sock->addr.un.data = data;
         sock->addr.un.dentry = dent;
     }
+	else { /* AF_INET/INET6 case */
+		if (addrlen != ((sock->domain == AF_INET) ? sizeof(struct sockaddr_in) :
+					sizeof(struct sockaddr_in6)))
+			goto out;
 
-    if (addrlen != ((sock->domain == AF_INET) ? sizeof(struct sockaddr_in) :
-                    sizeof(struct sockaddr_in6)))
-            goto out;
-
-    inet_save_addr(sock->domain, &sock->addr.in.bind, addr);
-    inet_rebase_port(false, sock->domain, &sock->addr.in.bind, true);
+		inet_save_addr(sock->domain, &sock->addr.in.bind, addr);
+		inet_rebase_port(false, sock->domain, &sock->addr.in.bind, true);
+	}
 
     sock->sock_state = SOCK_BOUND;
 
@@ -699,12 +700,14 @@ int shim_do_connect (int sockfd, struct sockaddr * addr, int addrlen)
         hdl->pal_handle = NULL;
     }
 
-    if (addrlen != ((sock->domain == AF_INET) ? sizeof(struct sockaddr_in) :
-                    sizeof(struct sockaddr_in6)))
-            goto out;
+	if (sock->domain != AF_UNIX) {
+		if (addrlen != ((sock->domain == AF_INET) ? sizeof(struct sockaddr_in) :
+					sizeof(struct sockaddr_in6)))
+			goto out;
 
-    inet_save_addr(sock->domain, &sock->addr.in.conn, addr);
-    inet_rebase_port(false, sock->domain, &sock->addr.in.conn, false);
+		inet_save_addr(sock->domain, &sock->addr.in.conn, addr);
+		inet_rebase_port(false, sock->domain, &sock->addr.in.conn, false);
+	}
 
     sock->sock_state = (state == SOCK_BOUND) ? SOCK_BOUNDCONNECTED :
                                                SOCK_CONNECTED;

+ 2 - 0
LibOS/shim/test/native/manifest.template

@@ -27,3 +27,5 @@ sgx.trusted_files.libm = file:$(LIBCDIR)/libm.so.6
 sgx.trusted_files.libpthread = file:$(LIBCDIR)/libpthread.so.0
 sgx.trusted_files.victim = file:exec_victim
 sgx.trusted_children.victim = file:exec_victim.sig
+
+sgx.trusted_files.unix_pipe = file:unix.c

+ 1 - 1
LibOS/shim/test/native/unix.c

@@ -151,7 +151,7 @@ int client(void)
 int main(int argc, char ** argv)
 {
     char fnamebuf[40];
-    strcpy(fnamebuf, argv[0]);
+    strcpy(fnamebuf, "unix");
     strcat(fnamebuf, ".c");
     fname = fnamebuf;