Skip to content

Commit 67c8a5e

Browse files
Snorch3idey
authored andcommitted
sk-queue: order unixsk sent to other unixsk after it
Here is how we dump nested unix sockets inside unix sockets: +-> dump_one_unix_fd <-+ +-> dump_sk_queue | +-> dump_sk_queue_packet | +-> dump_packet_cmsg | +-> dump_one_file | +-> do_dump_gen_file + +-> queue_packet_entry +-> list_add_tail(packets_list) So in the images more deeper unix socket goes strictly before the more shallow one. Before this patch on restore we also had the same reverse order due to list_add_tail used when adding to packets_list. Because of it we first handle deeper sockets in prepare_scms and later shallow ones. This is conterintuitive because in case of nested unix sockets without any actual open fds on them we need to find out which task should create them (file_master()->task) and in unix_note_scm_rights we determine this owner from queuer which can also have it yet unset because it would be handled later in prepare_scms. Let's reverse the walk order on restore in prepare_scms. Note: we can't just reverse the order in list as we rely in restore_sk_queue that packets of one socket are in original order. Signed-off-by: Pavel Tikhomirov <ptikhomirov@virtuozzo.com> (cherry picked from commit db11de636842c29ca21e9176cd43b785c7379c56) Signed-off-by: Ahmed Elaidy <elaidya225@gmail.com>
1 parent ca03262 commit 67c8a5e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

criu/sk-queue.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -719,8 +719,8 @@ int prepare_scms(void)
719719
struct sk_packet *pkt;
720720

721721
pr_info("Preparing SCMs\n");
722-
list_for_each_entry(pkt, &packets_list, list) {
723-
SkPacketEntry *pe = pkt->entry;
722+
list_for_each_entry_reverse(pkt, &packets_list, list) {
723+
SkPacketEntry *pe = pkt->entry;
724724
ScmEntry *se;
725725
struct cmsghdr *ch;
726726

0 commit comments

Comments
 (0)