[CRIU] CRIU segfaulting when restoring a process

Dmitry Safonov dsafonov at virtuozzo.com
Fri Aug 19 05:34:31 PDT 2016


On 08/19/2016 02:53 PM, Dmitry Safonov wrote:
> On 08/19/2016 02:48 PM, Nikolay Borisov wrote:
>>
>>
>> On 08/19/2016 02:40 PM, Dmitry Safonov wrote:
>>> On 08/19/2016 01:25 PM, Nikolay Borisov wrote:
>>>> Does this help:  http://paste.ubuntu.com/23069854/ ?
>>>
>>> Yes, thanks.
>>> So, it does crash here:
>>> b27:       48 89 02                mov    %rax,(%rdx)
>>> And %rdx was set earlier here:
>>> afa:       48 8b 15 00 00 00 00    mov    0x0(%rip),%rdx
>>>
>>> This is simple R_X86_64_PC32 relocation at this place.
>>> So, as compel successfuly patched this relative relocations here
>>> (in the same function earlier):
>>>      b01:       48 89 05 00 00 00 00    mov    %rax,0x0(%rip)
>>>      b0f:       89 05 00 00 00 00       mov    %eax,0x0(%rip)
>>>      b1c:       48 89 05 00 00 00 00    mov    %rax,0x0(%rip)
>>>
>>> It should have resolved this place too (the reason of fail)
>>> afa:       48 8b 15 00 00 00 00    mov    0x0(%rip),%rdx
>>>
>>> The question, has compel patched it?
>>> To check it, it would be worth if you do the following:
>>> 1. compile CRIU, like `make -j5`
>>> 2. then do `touch criu/pie/restorer.c`
>>> 3. copy, please, the output of `make V=1` to pastebin.
>>
>> http://paste.ubuntu.com/23070061/
>>
>> [SNIP]
>
> Thanks, that's good.
> So, it saw the relocation (0xafd), but hasn't patched it, AFACS:
>
> restorer_blob:         r_offset 0xafd  r_info 0xd000000009 / sym 0xd0
> type 0x9  symsecoff 0x0
> restorer_blob:         r_offset 0xb04  r_info 0x200000002 / sym 0x2
> type 0x2 symsecoff 0x0
> restorer_blob:             value 0x0        addend32 44   addend64
> 44       place b04      symname
> restorer_blob:                 R_X86_64_PC32     at 0xb04  val 0x42b0
>
> So, that looks like the reason of segfault. Let me check the compel
> code, wtf it didn't patch the relative relocation.

Hmm, so, what I came to is that the symbol at this address is SHN_UNDEF,
which means, it's external and must be linked.

First is the question about your gcc version :)
Could you try with a newer just for sure?
And the second which may be also the reason -- maybe something hasn't
linked to your restorer binary, which would answer the size of PIE and
problem about external symbols -- I'll check if this may be a pitfall 
with defined USERCFLAGS on build.

-- 
              Dmitry


More information about the CRIU mailing list