[CRIU] [PATCH 1/2] seccomp: is optional when parsing /proc/pid/status

Tycho Andersen tycho.andersen at canonical.com
Sat Nov 21 08:56:41 PST 2015


Also define some constants for people who don't have them in their headers.

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
Acked-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 include/seccomp.h | 8 ++++++++
 proc_parse.c      | 6 +++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/include/seccomp.h b/include/seccomp.h
index f87584f..b5b26c8 100644
--- a/include/seccomp.h
+++ b/include/seccomp.h
@@ -18,6 +18,14 @@
 #define SECCOMP_MODE_FILTER 2
 #endif
 
+#ifndef SECCOMP_SET_MODE_FILTER
+#define SECCOMP_SET_MODE_FILTER 1
+#endif
+
+#ifndef SECCOMP_FILTER_FLAG_TSYNC
+#define SECCOMP_FILTER_FLAG_TSYNC 1
+#endif
+
 extern int collect_seccomp_filters(void);
 extern int prepare_seccomp_filters(void);
 extern int seccomp_filters_get_rst_pos(CoreEntry *item, int *count, unsigned long *pos);
diff --git a/proc_parse.c b/proc_parse.c
index a4cd4f6..60b68a1 100644
--- a/proc_parse.c
+++ b/proc_parse.c
@@ -758,6 +758,7 @@ int parse_pid_status(pid_t pid, struct proc_status_creds *cr)
 	int done = 0;
 	int ret = -1;
 	char *str;
+	bool parsed_seccomp = false;
 
 	f.fd = open_proc(pid, "status");
 	if (f.fd < 0) {
@@ -843,12 +844,15 @@ int parse_pid_status(pid_t pid, struct proc_status_creds *cr)
 				goto err_parse;
 			}
 
+			parsed_seccomp = true;
+
 			done++;
 			continue;
 		}
 	}
 
-	if (done >= 8)
+	/* seccomp is optional */
+	if (done >= 8 || (done == 7 && !parsed_seccomp))
 		ret = 0;
 
 err_parse:
-- 
2.5.0



More information about the CRIU mailing list