[CRIU] [PATCH 21/28] seccomp: Always setup chain flags

Cyrill Gorcunov gorcunov at gmail.com
Wed Mar 21 00:43:06 MSK 2018


From: Cyrill Gorcunov <gorcunov at openvz.org>

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 criu/seccomp.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/criu/seccomp.c b/criu/seccomp.c
index 63f1e98296cb..658e9b399ab6 100644
--- a/criu/seccomp.c
+++ b/criu/seccomp.c
@@ -171,6 +171,9 @@ static int collect_filter(struct seccomp_entry *entry)
 
 		seccomp_filter__init(&chain->filter);
 
+		chain->filter.has_flags = true;
+		chain->filter.flags = 0;
+
 		chain->filter.filter.len = len * sizeof(struct sock_filter);
 		chain->filter.filter.data = xmalloc(chain->filter.filter.len);
 		if (!chain->filter.filter.data) {
@@ -180,10 +183,8 @@ static int collect_filter(struct seccomp_entry *entry)
 
 		memcpy(chain->filter.filter.data, buf, chain->filter.filter.len);
 
-		if (meta) {
-			chain->filter.has_flags = true;
-			chain->filter.flags = meta->flags;
-		}
+		if (meta)
+			chain->filter.flags |= meta->flags;
 
 		prev = entry->chain, entry->chain = chain, chain->prev = prev;
 		entry->nr_chains++;
-- 
2.14.3



More information about the CRIU mailing list