From: Jingxian He hejingxian@huawei.com
Fix eventpollfd problem of improper usage in appdata.
Conflict:NA Reference:https://gitee.com/src-openeuler/criu/pulls/21 Signed-off-by: Jingxian He hejingxian@huawei.com Signed-off-by: fu.lin fu.lin10@huawei.com --- criu/eventpoll.c | 16 +++++++++++----- criu/proc_parse.c | 2 ++ images/eventpoll.proto | 3 +++ 3 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/criu/eventpoll.c b/criu/eventpoll.c index 9818f24..6097e42 100644 --- a/criu/eventpoll.c +++ b/criu/eventpoll.c @@ -67,8 +67,8 @@ int is_eventpoll_link(char *link)
static void pr_info_eventpoll_tfd(char *action, uint32_t id, EventpollTfdEntry *e) { - pr_info("%seventpoll-tfd: id %#08x tfd %8d events %#08x data %#016"PRIx64"\n", - action, id, e->tfd, e->events, e->data); + pr_info("%seventpoll-tfd: id %#08x tfd %8d events %#08x data %#016"PRIx64" ignore %d\n", + action, id, e->tfd, e->events, e->data, e->ignore); }
static void pr_info_eventpoll(char *action, EventpollFileEntry *e) @@ -146,9 +146,9 @@ int flush_eventpoll_dinfo_queue(void) }; struct kid_elem *t = kid_lookup_epoll_tfd(&fd_tree, &ke, &slot); if (!t) { - pr_debug("kid_lookup_epoll: no match pid %d efd %d tfd %d toff %u\n", - dinfo->pid, dinfo->efd, tfde->tfd, dinfo->toff[i].off); - goto err; + tfde->ignore = 1; + pr_info("Drop tfd entry, efd=%d, tfd=%d\n", slot.efd, slot.tfd); + continue; }
pr_debug("kid_lookup_epoll: rbsearch match pid %d efd %d tfd %d toff %u -> %d\n", @@ -161,6 +161,7 @@ int flush_eventpoll_dinfo_queue(void) goto err; }
+ pr_info("Change tfd: %d -> %d @ efd=%d\n", tfde->tfd, t->idx, slot.efd); tfde->tfd = t->idx; }
@@ -416,6 +417,11 @@ static int eventpoll_retore_tfd(int fd, int id, EventpollTfdEntry *tdefe) { struct epoll_event event;
+ if (tdefe->ignore) { + pr_info_eventpoll_tfd("Ignore ", id, tdefe); + return 0; + } + pr_info_eventpoll_tfd("Restore ", id, tdefe);
event.events = tdefe->events; diff --git a/criu/proc_parse.c b/criu/proc_parse.c index 4f5bbaa..32d84b3 100644 --- a/criu/proc_parse.c +++ b/criu/proc_parse.c @@ -1921,10 +1921,12 @@ static int parse_fdinfo_pid_s(int pid, int fd, int type, void *arg) e->has_dev = false; e->has_inode = false; e->has_pos = false; + e->has_ignore = false; } else if (ret == 6) { e->has_dev = true; e->has_inode = true; e->has_pos = true; + e->has_ignore = true; } else if (ret < 6) { eventpoll_tfd_entry__free_unpacked(e, NULL); goto parse_err; diff --git a/images/eventpoll.proto b/images/eventpoll.proto index 4a8d1b8..20c9a15 100644 --- a/images/eventpoll.proto +++ b/images/eventpoll.proto @@ -12,6 +12,9 @@ message eventpoll_tfd_entry { optional uint32 dev = 5; optional uint64 inode = 6; optional uint64 pos = 7; + + /* entry validation */ + optional uint32 ignore = 8; }
message eventpoll_file_entry {