Open cuiyunhui-1 opened 9 months ago
@osctobe
I am not sure that I understand the question. What is st_mode in this context? Where do we restore it for memfd, socket, reg-files?
I am not sure that I understand the question. What is st_mode in this context? Where do we restore it for memfd, socket, reg-files?
static int memfd_open_inode_nocache(struct memfd_restore_inode *inode) { ...
fd = memfd_create(mie->name, flags);
if (restore_memfd_shmem_content(fd, mie->shmid, mie->size))
goto out;
if (mie->has_mode)
ret = cr_fchperm(fd, mie->uid, mie->gid, mie->mode);
else
ret = cr_fchown(fd, mie->uid, mie->gid);
...
}
What I want to know is why CRIU doesn’t uniformly perform st_mode on all fd types. rebuild(restore), but only st_mode for sk-unix, memfd, reg-file recovery,?
@avagin
What I want to know is why CRIU doesn’t uniformly perform st_mode on all fd types.
You are right, we may need to restore mode, uid, gid for mentioned. However, we have to decide whether we need to do that for each file type separately. For example, there is no need to do this for eventfd since, in the kernel, all eventfd instances are linked to the same anonymous inode.: https://elixir.bootlin.com/linux/latest/source/fs/eventfd.c#L418 https://elixir.bootlin.com/linux/latest/source/fs/anon_inodes.c#L147 https://elixir.bootlin.com/linux/latest/source/fs/anon_inodes.c#L97
Secondly, for certain file types, it is less critical since users typically do not reopen them through file systems.
@avagin okay,thank you!
A friendly reminder that this issue had no activity for 30 days.
@emmir