linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Safonov <0x7f454c46@gmail.com>
To: Christophe Leroy <christophe.leroy@csgroup.eu>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Laurent Dufour <ldufour@linux.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: VDSO ELF header
Date: Fri, 26 Mar 2021 15:13:35 +0000	[thread overview]
Message-ID: <e8c2b4b5-f0b6-945e-4a42-c2308dd719a2@gmail.com> (raw)
In-Reply-To: <c7e0568f-786b-2c1c-fb6d-cd804bc1b539@csgroup.eu>

Hello,

On 3/26/21 10:50 AM, Christophe Leroy wrote:
> 
> 
> Le 26/03/2021 à 11:46, Michael Ellerman a écrit :
>> Laurent Dufour <ldufour@linux.ibm.com> writes:
>>> Le 25/03/2021 à 17:56, Laurent Dufour a écrit :
>>>> Le 25/03/2021 à 17:46, Christophe Leroy a écrit :
>>>>> Le 25/03/2021 à 17:11, Laurent Dufour a écrit :
>>>>>> Since v5.11 and the changes you made to the VDSO code, it no more
>>>>>> exposing
>>>>>> the ELF header at the beginning of the VDSO mapping in user space.
>>>>>>
>>>>>> This is confusing CRIU which is checking for this ELF header cookie
>>>>>> (https://github.com/checkpoint-restore/criu/issues/1417).
>>>>>
>>>>> How does it do on other architectures ?
>>>>
>>>> Good question, I'll double check the CRIU code.
>>>
>>> On x86, there are 2 VDSO entries:
>>> 7ffff7fcb000-7ffff7fce000 r--p 00000000 00:00
>>> 0                          [vvar]
>>> 7ffff7fce000-7ffff7fcf000 r-xp 00000000 00:00
>>> 0                          [vdso]
>>>
>>> And the VDSO is starting with the ELF header.
>>>
>>>>>> I'm not an expert in loading and ELF part and reading the change
>>>>>> you made, I
>>>>>> can't identify how this could work now as I'm expecting the loader
>>>>>> to need
>>>>>> that ELF header to do the relocation.
>>>>>
>>>>> I think the loader is able to find it at the expected place.
>>>>
>>>> Actually, it seems the loader relies on the AUX vector
>>>> AT_SYSINFO_EHDR. I guess
>>>> CRIU should do the same.
>>>>
>>>>>>
>>>>>>   From my investigation it seems that the first bytes of the VDSO
>>>>>> area are now
>>>>>> the vdso_arch_data.
>>>>>>
>>>>>> Is the ELF header put somewhere else?
>>>>>> How could the loader process the VDSO without that ELF header?
>>>>>>
>>>>>
>>>>> Like most other architectures, we now have the data section as
>>>>> first page and
>>>>> the text section follows. So you will likely find the elf header on
>>>>> the second
>>>>> page.
>>>
>>> I'm wondering if the data section you're refering to is the vvar
>>> section I can
>>> see on x86.
>>
>> Many of the other architectures have separate vm_special_mapping's for
>> the data page and the vdso binary, where the former is called "vvar".
>>
>> eg, s390:
>>
>> static struct vm_special_mapping vvar_mapping = {
>>     .name = "[vvar]",
>>     .fault = vvar_fault,
>> };
>>
>> static struct vm_special_mapping vdso_mapping = {
>>     .name = "[vdso]",
>>     .mremap = vdso_mremap,
>> };
>>
>>
>> I guess we probably should be doing that too.
>>
> 
> Dmitry proposed the same, see
> https://github.com/0x7f454c46/linux/commit/783c7a2532d2219edbcf555cc540eab05f698d2a
> 
> 
> Discussion at https://github.com/checkpoint-restore/criu/issues/1417

Yeah, I didn't submit it officially to lkml because I couldn't test it
yet (and I usually don't send untested patches). The VM I have fails to
kexec and there's some difficulty to get serial console working, so I'd
appreciate if someone could either pick it up, or add tested-by.

Thanks,
          Dmitry

  reply	other threads:[~2021-03-26 15:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <c45ae4f8-1cbc-c687-b6a2-9a431fafc85c@linux.ibm.com>
2021-03-25 16:46 ` VDSO ELF header Christophe Leroy
2021-03-25 16:56   ` Laurent Dufour
2021-03-25 19:02     ` Laurent Dufour
2021-03-26 10:46       ` Michael Ellerman
2021-03-26 10:50         ` Christophe Leroy
2021-03-26 15:13           ` Dmitry Safonov [this message]
2021-03-26 16:11             ` Christophe Leroy
2021-03-26 16:32               ` Dmitry Safonov
2021-03-26 17:07                 ` Christophe Leroy
2021-03-26 17:11                   ` Dmitry Safonov
2021-03-26 18:40                     ` Christophe Leroy
2021-03-26 18:54                       ` Dmitry Safonov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e8c2b4b5-f0b6-945e-4a42-c2308dd719a2@gmail.com \
    --to=0x7f454c46@gmail.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=ldufour@linux.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).