Commit cc9587ff authored by Tycho Andersen's avatar Tycho Andersen Committed by Pavel Emelyanov

seccomp: is optional when parsing /proc/pid/status

Also define some constants for people who don't have them in their headers.
Signed-off-by: 's avatarTycho Andersen <tycho.andersen@canonical.com>
Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent 3364992d
...@@ -18,6 +18,14 @@ ...@@ -18,6 +18,14 @@
#define SECCOMP_MODE_FILTER 2 #define SECCOMP_MODE_FILTER 2
#endif #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 collect_seccomp_filters(void);
extern int prepare_seccomp_filters(void); extern int prepare_seccomp_filters(void);
extern int seccomp_filters_get_rst_pos(CoreEntry *item, int *count, unsigned long *pos); extern int seccomp_filters_get_rst_pos(CoreEntry *item, int *count, unsigned long *pos);
......
...@@ -758,6 +758,7 @@ int parse_pid_status(pid_t pid, struct proc_status_creds *cr) ...@@ -758,6 +758,7 @@ int parse_pid_status(pid_t pid, struct proc_status_creds *cr)
int done = 0; int done = 0;
int ret = -1; int ret = -1;
char *str; char *str;
bool parsed_seccomp = false;
f.fd = open_proc(pid, "status"); f.fd = open_proc(pid, "status");
if (f.fd < 0) { if (f.fd < 0) {
...@@ -845,6 +846,7 @@ int parse_pid_status(pid_t pid, struct proc_status_creds *cr) ...@@ -845,6 +846,7 @@ int parse_pid_status(pid_t pid, struct proc_status_creds *cr)
goto err_parse; goto err_parse;
} }
parsed_seccomp = true;
done++; done++;
continue; continue;
} }
...@@ -861,7 +863,8 @@ int parse_pid_status(pid_t pid, struct proc_status_creds *cr) ...@@ -861,7 +863,8 @@ int parse_pid_status(pid_t pid, struct proc_status_creds *cr)
} }
} }
if (done >= 10) /* seccomp is optional */
if (done >= 10 || (done == 9 && !parsed_seccomp))
ret = 0; ret = 0;
err_parse: err_parse:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment