Re: [PATCH v4 1/2] xen/PVH: Set up GS segment for stack canary

From: Jan Beulich
Date: Wed May 23 2018 - 02:24:17 EST


>>> On 22.05.18 at 19:10, <boris.ostrovsky@xxxxxxxxxx> wrote:
> On 05/22/2018 12:32 PM, Jan Beulich wrote:
>>>>> On 22.05.18 at 18:20, <boris.ostrovsky@xxxxxxxxxx> wrote:
>>> We are loading virtual address for $canary so we will always have EDX
>>> set to 0xffffffff. Isn't that what we want?
>> Oh, that's rather confusing - we're still running on the low 1:1
>> mapping when we're here. But yes, by the time we enter C code
>> (where the GS base starts to matter) we ought to be on the high
>> mappings - if only there wasn't xen_prepare_pvh().
>
> xen_prepare_pvh() (and whatever it might call) is the only reason for
> this patch to exist. It's the only C call that we are making before
> jumping to startup_64, which I assume will have to set up GS itself
> before calling into C.
>
> I didn't realize we are still on identity mapping. I'll clear EDX (and
> load $_pa(canary)) then.
>
> BTW, don't we have the same issue in startup_xen()?

I don't think so, no - there we're on the high mappings already (the
ELF note specifies the virtual address of the entry point, after all).

Jan