[CRIU] [PATCH 2/3] sfd: Make sure we're not overwriting existing files

Cyrill Gorcunov gorcunov at gmail.com
Tue Apr 2 10:17:46 MSK 2019


On Mon, Apr 01, 2019 at 10:28:10PM -0700, Andrey Vagin wrote:
> On Fri, Mar 29, 2019 at 08:55:23PM +0300, Cyrill Gorcunov wrote:
> > Just a warn for now since we need to investigate
> > every case without breaking ci.
> 
> We don't have these cases, so it should be an error.

We already have these cases as by sfd design, and if
I trigger an error the ci will be broken.

> 
> Here is one inline comment
...
> You have to check that this service_fd has not been installed yet:
> 	if (!test_bit(type, sfd_map))
> 

For install service it is already there. For move_service_fd
it is not and I'm not sure if it should test for sfd_map

> > +	sfd_verify_targtet(type, fd, sfd);
> >  	if (dup3(fd, sfd, O_CLOEXEC) != sfd) {
> >  		pr_perror("Dup %d -> %d failed", fd, sfd);
> >  		close(fd);
> > @@ -166,6 +165,7 @@ static void move_service_fd(struct pstree_item *me, int type, int new_id, int ne
> >  	if (old < 0)
> >  		return;
> >  
> > +	sfd_verify_targtet(type, old, new);
> >  	ret = dup2(old, new);
> >  	if (ret == -1) {
> >  		if (errno != EBADF)


More information about the CRIU mailing list