[CRIU] [PATCH 0/2] Make the test static/file_fown pass on ARM

Alexander Kartashov alekskartashov at parallels.com
Mon Jan 28 04:30:06 EST 2013


On 01/28/2013 12:22 PM, Alexander Kartashov wrote:
> Dear colleagues,
>
> This patchset makes the static/file_fown pass on ARM
> by introducing the correct value of the macro O_LARGEFILE
> for the x86 and ARM architecures.
>
> --
> Sincerely yours,
> Alexander Kartashov
>
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu

The problem with the test static/file_fown is the following
as the comment reads:

         /*
          * The kernel's O_LARGEFILE set automatically
          * on open() in x86-64, so unmask it explicitly
          * we restore pipes via open call while the former
          * pipes are created with pipe() and have no O_LARGEFILE
          * set.
          */

When a pipe is restored it's writing end is re-opened
using glibc open() that adds the flag O_LARGEFILE:

static int recv_pipe_fd(struct pipe_info *pi)
{
         struct fdinfo_list_entry *fle;
         char path[32];
         int tmp, fd;

         fle = file_master(&pi->d);
         fd = fle->fe->fd;

         pr_info("\tWaiting fd for %d\n", fd);

         tmp = recv_fd(fd);
         if (tmp < 0) {
                 pr_err("Can't get fd %d\n", tmp);
                 return -1;
         }
         close(fd);

         snprintf(path, sizeof(path), "/proc/self/fd/%d", tmp);
         fd = open(path, pi->pe->flags);
         close(tmp);

         if (fd >= 0) {
                 if (restore_fown(fd, pi->pe->fown)) {
                         close(fd);
                         return -1;
                 }
         }

         return fd;
}

Isn't it better to replace glibc open() with a direct syscall here
as proposed by Anrew Vagin?

-- 
Sincerely yours,
Alexander Kartashov

Intern
Core team

www.parallels.com

Skype: aleksandr.kartashov
Email: alekskartashov at parallels.com



More information about the CRIU mailing list