[lxc-devel] [lxc/master] sync: fail on unexpected message sizes

tych0 on Github lxc-bot at linuxcontainers.org
Fri May 6 16:23:08 UTC 2016


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 477 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20160506/1cd7f0f9/attachment.bin>
-------------- next part --------------
From fcd59cf0c84f1523768da0377d260c65c090e650 Mon Sep 17 00:00:00 2001
From: Tycho Andersen <tycho.andersen at canonical.com>
Date: Fri, 6 May 2016 11:21:39 -0500
Subject: [PATCH] sync: fail on unexpected message sizes

I think (?) this may be related to our hanging monitor bug. Let's do this
anyway, as it's probably a good idea.

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 src/lxc/sync.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/lxc/sync.c b/src/lxc/sync.c
index f06d302..82f68e3 100644
--- a/src/lxc/sync.c
+++ b/src/lxc/sync.c
@@ -47,6 +47,11 @@ static int __sync_wait(int fd, int sequence)
 	if (!ret)
 		return 0;
 
+	if (ret != sizeof(sync)) {
+		ERROR("unexpected sync size: %d expected %lu", ret, sizeof(sync));
+		return -1;
+	}
+
 	if (sync == LXC_SYNC_ERROR) {
 		ERROR("An error occurred in another process "
 		      "(expected sequence number %d)", sequence);


More information about the lxc-devel mailing list