[CRIU] [PATCH] criu: correctly handle mixed-permission mapped files
Jamie Liu
jamieliu at google.com
Wed Apr 2 10:38:32 PDT 2014
Cheers, it is much easier to pick flags in get_filemap_fd(); I'd
missed that get_filemap_fd() is per-mapping. I'll mail a v2 once I've
also written a zdtm test.
On Wed, Apr 2, 2014 at 5:07 AM, Pavel Emelyanov <xemul at parallels.com> wrote:
> On 04/02/2014 12:25 AM, Jamie Liu wrote:
>> An mmaped file is opened O_RDONLY or O_RDWR depending on the permissions
>> on the first vma dump_task_mm() encounters mapping that file. This means
>> that if a file has multiple MAP_SHARED mappings, some of which are
>> read-only and some of which are read-write, and the first encountered
>> mapping happens to be read-only, the file will be opened with O_RDONLY
>> during restore, and mmap(PROT_WRITE) will fail with EACCES.
>
> Good catch, thanks! :)
>
>> To fix this, allow multiple RegFileEntry messages with the same id;
>> later RegFileEntry messages update flags in existing file_descs.
>
> Maybe it's much easier just to ignore the flags for filemap rfe-s (dump them
> as zeros) and tune the get_filemap_fd() so that it passes correct flag (the
> one required to map a vma) into do_openreg_noseek?
>
> It would also be nice if we have this test in zdtm/ suite to prevent accidental
> breakage of this functionality in the future.
>
>> Signed-off-by: Jamie Liu <jamieliu at google.com>
>
> Thanks,
> Pavel
More information about the CRIU
mailing list