[CRIU] [PATCH 07/27] seccomp: Drop pstree_item from find_inherited
Cyrill Gorcunov
gorcunov at openvz.org
Thu Mar 1 15:41:29 MSK 2018
From: Cyrill Gorcunov <gorcunov at virtuozzo.com>
The filters array is flat, we only need a start position here.
Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
---
criu/seccomp.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/criu/seccomp.c b/criu/seccomp.c
index c9ceb2e7dd1f..90a708117390 100644
--- a/criu/seccomp.c
+++ b/criu/seccomp.c
@@ -63,8 +63,7 @@ int seccomp_collect_entry(const struct pstree_item *item, pid_t tid, unsigned in
static int next_filter_id = 0;
static struct seccomp_info **filters = NULL;
-static struct seccomp_info *find_inherited(struct pstree_item *parent,
- struct sock_filter *filter,
+static struct seccomp_info *find_inherited(int last_filter, struct sock_filter *filter,
int len, struct seccomp_metadata *meta)
{
struct seccomp_info *info;
@@ -73,7 +72,7 @@ static struct seccomp_info *find_inherited(struct pstree_item *parent,
if (!filters)
return NULL;
- for (info = filters[dmpi(parent)->pi_creds->last_filter]; info; info = info->prev) {
+ for (info = filters[last_filter]; info; info = info->prev) {
if (len != info->filter.filter.len)
continue;
@@ -95,7 +94,7 @@ static int collect_filter_for_pstree(struct pstree_item *item)
struct seccomp_metadata meta_buf, *meta = &meta_buf;
struct seccomp_info *infos = NULL, *cursor;
struct seccomp_entry *entry;
- int info_count, i, ret = -1;
+ int info_count, i, last_filter, ret = -1;
struct sock_filter buf[BPF_MAXINSNS];
void *m;
@@ -140,7 +139,8 @@ static int collect_filter_for_pstree(struct pstree_item *item)
}
}
- inherited = find_inherited(item->parent, buf, len, meta);
+ last_filter = dmpi(item->parent)->pi_creds->last_filter;
+ inherited = find_inherited(last_filter, buf, len, meta);
if (inherited) {
bool found = false;
--
2.14.3
More information about the CRIU
mailing list