[CRIU] [PATCH v4] criu: fix filemap open permissions

Pavel Emelyanov xemul at parallels.com
Fri Apr 4 12:48:43 PDT 2014


On 04/04/2014 11:28 PM, Pavel Emelyanov wrote:
> On 04/04/2014 11:24 PM, Andrew Vagin wrote:
>> On Fri, Apr 04, 2014 at 10:27:42AM -0700, Jamie Liu wrote:
>>> No problem, I only didn't respond because I was asleep. :) I'll send a
>>> compatibility fix today.
>>
>> Looks like here are not only compatibility problems:
>> $ bash test/zdtm.sh static/maps00
>> ...
>> 23:19:39.723: 29890: map: ptr 0x7fa5e426d000 flag        2 prot        0
>> 23:19:39.723: 29890: map: ptr 0x7fa5e426b000 flag        1 prot        0
>> 23:19:39.723: 29890: map: ptr 0x7fa5e4269000 flag       22 prot        0
>> 23:19:39.724: 29890: map: ptr 0x7fa5e4267000 flag       21 prot        0
>> 23:19:39.724: 29890: map: ptr 0x7fa5e4265000 flag        2 prot        1
>> 23:19:39.724: 29890: map: ptr 0x7fa5e4263000 flag        1 prot        1
>> 23:19:39.725: 29890: map: ptr 0x7fa5e425d000 flag       22 prot        1
>> 23:19:39.725: 29890: map: ptr 0x7fa5e425b000 flag       21 prot        1
>> 23:19:39.725: 29890: map: ptr 0x7fa5e4259000 flag        2 prot        3
>> 23:19:39.725: 29890: map: ptr 0x7fa5e4257000 flag        1 prot        3
>> 23:19:39.726: 29890: map: ptr 0x7fa5e4255000 flag       22 prot        3
>> 23:19:39.726: 29890: map: ptr 0x7fa5e4253000 flag       21 prot        3
>> 23:19:39.726: 29890: map: ptr 0x7fa5e4251000 flag        2 prot        7
>> 23:19:39.727: 29890: map: ptr 0x7fa5e424f000 flag        1 prot        7
>> 23:19:39.727: 29890: map: ptr 0x7fa5e424d000 flag       22 prot        7
>> 23:19:39.727: 29890: map: ptr 0x7fa5e424b000 flag       21 prot        7
>> 23:19:40.013: 29890: ERR: maps00.c:181: failed to write maps00.test-00: Bad file descriptor
>>  (errno = 9 (Bad file descriptor))
>> ------------------------------------- END -------------------------------------
>> ================================= ERROR OVER =================================
>>
>> It's because you rewrite flags of a file, which is associated with a
>> file descriptor, so this fd is restored with wrong flags.
> 
> Entries for files and for vma files do not intersect. There's some other reason for that.
> 


No, it looks like they can. The fd_id_cache_one() compares dev and ino
of files for both -- vmas and fds and may report the same ID for vma
and file.

Thanks,
Pavel


More information about the CRIU mailing list