[CRIU] multiple open() on a file during restore

CRIU criu criuport at gmail.com
Fri Jun 26 11:20:54 PDT 2015


So I'm adding support for Android binder, which assumes that a process will
open the device only once. Based on the existing code flow, the device is
opened two times during restore.

I see the following sequence open() -> mmap() -> close() -> open()
This causes incorrect bookkeeping insider binder driver.

On Fri, Jun 26, 2015 at 5:25 AM, Pavel Emelyanov <xemul at parallels.com>
wrote:

> On 06/26/2015 09:47 AM, CRIU criu wrote:
> > Hi,
> >
> > Does CRIU do multiple open() on a regular file during restore?
>
> If it's opened and mapped multiple times, then yes. If a file is opened
> once and then fd is inherited then open is called once.
>
> > If yes, multiple open() on some device files may lead to incorrect
> > bookkeeping inside the kernel driver.
>
> It depends on the device.
>
> > Please correct me if my understanding is wrong. Thanks!
> >
> > I see the following code being executed:
> > prepare_mappings() -> premap_priv_vmas()
> ->map_private_vma()->get_filemap_fd(vma)
> >
> > This is followed by close(vma-e->fd)
>
> Yes, this is about mapped files. Right now criu doesn't support for
> mapped devices except for /dev/zero, so we're (still) safe here :)
>
> -- Pavel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvz.org/pipermail/criu/attachments/20150626/004e251f/attachment.html>


More information about the CRIU mailing list