Projects STRLCPY criu Commits 5f757278
🤬
  • epol: Sanitize epoll tfds collecting

    This case is legacy, tfds are merged into epoll entry, but
    to make it working we have separate list of tfds and extra
    code in ->open callback.
    
    Keep the legacy code in one place.
    
    Signed-off-by: Pavel Emelyanov <[email protected]>
    Signed-off-by: Andrei Vagin <[email protected]>
  • Loading...
  • Pavel Emelyanov committed 7 years ago
    5f757278
    1 parent c48099d8
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■
    criu/cr-restore.c
    skipped 261 lines
    262 262   &packet_sk_cinfo,
    263 263   &netlink_sk_cinfo,
    264 264   &eventfd_cinfo,
    265  - &epoll_tfd_cinfo,
    266 265   &epoll_cinfo,
     266 + &epoll_tfd_cinfo,
    267 267   &signalfd_cinfo,
    268 268   &inotify_cinfo,
    269 269   &inotify_mark_cinfo,
    skipped 3028 lines
  • ■ ■ ■ ■ ■ ■
    criu/eventpoll.c
    skipped 33 lines
    34 34   struct file_desc d;
    35 35  };
    36 36   
    37  -struct eventpoll_tfd_file_info {
    38  - EventpollTfdEntry *tdefe;
    39  - struct list_head list;
    40  -};
    41  - 
    42  -static LIST_HEAD(eventpoll_tfds);
    43  - 
    44 37  /* Checks if file descriptor @lfd is eventfd */
    45 38  int is_eventpoll_link(char *link)
    46 39  {
    skipped 141 lines
    188 181   
    189 182  static int eventpoll_post_open(struct file_desc *d, int fd)
    190 183  {
    191  - struct eventpoll_tfd_file_info *td_info;
    192 184   struct eventpoll_file_info *info;
    193 185   int i;
    194 186   
    skipped 8 lines
    203 195   return -1;
    204 196   }
    205 197   
    206  - list_for_each_entry(td_info, &eventpoll_tfds, list) {
    207  - if (epoll_not_ready_tfd(td_info->tdefe))
    208  - return 1;
    209  - }
    210  - list_for_each_entry(td_info, &eventpoll_tfds, list) {
    211  - if (td_info->tdefe->id != info->efe->id)
    212  - continue;
    213  - 
    214  - if (eventpoll_retore_tfd(fd, info->efe->id, td_info->tdefe))
    215  - return -1;
    216  - 
    217  - }
    218  - 
    219 198   return 0;
    220 199  }
    221 200   
    skipped 4 lines
    226 205   
    227 206  static int collect_one_epoll_tfd(void *o, ProtobufCMessage *msg, struct cr_img *i)
    228 207  {
    229  - struct eventpoll_tfd_file_info *info = o;
     208 + EventpollTfdEntry *tfde;
     209 + struct file_desc *d;
     210 + struct eventpoll_file_info *ef;
     211 + EventpollFileEntry *efe;
     212 + int n_tfd;
    230 213   
    231 214   if (!deprecated_ok("Epoll TFD image"))
    232 215   return -1;
    233 216   
    234  - info->tdefe = pb_msg(msg, EventpollTfdEntry);
    235  - list_add(&info->list, &eventpoll_tfds);
    236  - pr_info_eventpoll_tfd("Collected ", info->tdefe);
     217 + tfde = pb_msg(msg, EventpollTfdEntry);
     218 + d = find_file_desc_raw(FD_TYPES__EVENTPOLL, tfde->id);
     219 + if (!d) {
     220 + pr_err("No epoll FD for %u\n", tfde->id);
     221 + return -1;
     222 + }
     223 + 
     224 + ef = container_of(d, struct eventpoll_file_info, d);
     225 + efe = ef->efe;
     226 + 
     227 + n_tfd = efe->n_tfd + 1;
     228 + if (xrealloc_safe(&efe->tfd, n_tfd * sizeof(EventpollTfdEntry *)))
     229 + return -1;
     230 + 
     231 + efe->tfd[efe->n_tfd] = tfde;
     232 + efe->n_tfd = n_tfd;
    237 233   
    238 234   return 0;
    239 235  }
    skipped 1 lines
    241 237  struct collect_image_info epoll_tfd_cinfo = {
    242 238   .fd_type = CR_FD_EVENTPOLL_TFD,
    243 239   .pb_type = PB_EVENTPOLL_TFD,
    244  - .priv_size = sizeof(struct eventpoll_tfd_file_info),
    245 240   .collect = collect_one_epoll_tfd,
     241 + .flags = COLLECT_NOFREE,
    246 242  };
    247 243   
    248 244  static int collect_one_epoll(void *o, ProtobufCMessage *msg, struct cr_img *i)
    skipped 15 lines
Please wait...
Page is in error, reload to recover