[CRIU] [PATCH] unix: Do not autobind unnamed unix sockets

Kirill Tkhai ktkhai at virtuozzo.com
Wed Jun 15 03:57:11 PDT 2016


addlen equal to sizeof(addr.sun_family) leads
to autobinding of socket.

If it had been autobinded when we dumped it,
name.len wouldn't have been zero. So, this
binding is wrong. Fix that.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/sk-unix.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/criu/sk-unix.c b/criu/sk-unix.c
index c6cf672..9302d21 100644
--- a/criu/sk-unix.c
+++ b/criu/sk-unix.c
@@ -958,7 +958,7 @@ static int bind_unix_sk(int sk, struct unix_sk_info *ui)
 	if (prep_unix_sk_cwd(ui, &cwd_fd))
 		return -1;
 
-	if (bind(sk, (struct sockaddr *)&addr,
+	if (ui->ue->name.len && bind(sk, (struct sockaddr *)&addr,
 				sizeof(addr.sun_family) + ui->ue->name.len)) {
 		pr_perror("Can't bind socket");
 		goto done;



More information about the CRIU mailing list