[CRIU] [PATCH] parasite: the type of the communication socket must be SOCK_SEQPACKET

Andrey Vagin avagin at openvz.org
Wed Oct 2 08:54:26 PDT 2013


We use unix socket to communicate with parasite. Before we used
SOCK_STREAM, but it doesn't guaranty that the message boundaries will be
save.

Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 parasite-syscall.c | 2 +-
 pie/parasite.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/parasite-syscall.c b/parasite-syscall.c
index 26d363d..d479270 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -410,7 +410,7 @@ static int prepare_tsock(struct parasite_ctl *ctl, pid_t pid,
 				return -1;
 		}
 
-		ssock = socket(PF_UNIX, SOCK_STREAM, 0);
+		ssock = socket(PF_UNIX, SOCK_SEQPACKET, 0);
 		if (ssock < 0)
 			pr_perror("Can't create socket");
 
diff --git a/pie/parasite.c b/pie/parasite.c
index 927cc83..68ba97f 100644
--- a/pie/parasite.c
+++ b/pie/parasite.c
@@ -499,7 +499,7 @@ static noinline __used int parasite_init_daemon(void *data)
 
 	sigframe = args->sigframe;
 
-	tsock = sys_socket(PF_UNIX, SOCK_STREAM, 0);
+	tsock = sys_socket(PF_UNIX, SOCK_SEQPACKET, 0);
 	if (tsock < 0) {
 		pr_err("Can't create socket: %d\n", tsock);
 		goto err;
-- 
1.8.3.1



More information about the CRIU mailing list