From: "Jan Beulich" <JBeulich@suse.com>
To: <brgerst@gmail.com>
Cc: "xen-devel" <xen-devel@lists.xenproject.org>,
"Boris Ostrovsky" <boris.ostrovsky@oracle.com>,
"Juergen Gross" <jgross@suse.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v4 1/2] xen/PVH: Set up GS segment for stack canary
Date: Tue, 22 May 2018 10:10:53 -0600 [thread overview]
Message-ID: <5B04410D02000078001C4CC5@prv1-mh.provo.novell.com> (raw)
In-Reply-To: <CAMzpN2gRvYMmaf2+Fpi2wkAV_rcH=uDfM8sQQaaGGK2U=7XqMA@mail.gmail.com>
>>> On 22.05.18 at 17:15, <brgerst@gmail.com> wrote:
> On Tue, May 22, 2018 at 9:57 AM, Jan Beulich <JBeulich@suse.com> wrote:
>>>>> On 22.05.18 at 15:45, <brgerst@gmail.com> wrote:
>>> On Mon, May 21, 2018 at 11:54 PM, Boris Ostrovsky <boris.ostrovsky@oracle.com> wrote:
>>>> @@ -98,6 +101,12 @@ ENTRY(pvh_start_xen)
>>>> /* 64-bit entry point. */
>>>> .code64
>>>> 1:
>>>> + /* Set base address in stack canary descriptor. */
>>>> + mov $MSR_GS_BASE,%ecx
>>>> + mov $canary, %rax
>>>> + cdq
>>>> + wrmsr
>>>
>>> CDQ only sign-extends EAX to RAX. What you really want is to move the
>>> high 32-bits to EDX (or zero EDX if we can guarantee it is loaded
>>> below 4G).
>>
>> What you describe is CDQE (AT&T name: CLTD); CDQ (AT&T: CLTQ)
>> sign-extends EAX to EDX:EAX.
>
> But that would still be wrong, as it would set EDX to 0xFFFFFFFF if
> the kernel was loaded between 2G and 4G. Looking closer at the code,
> we just left 32-bit mode, so we must have been loaded below 4G,
> therefore EDX must be zero.
Ah, yes, indeed.
Jan
next prev parent reply other threads:[~2018-05-22 16:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-22 3:54 [PATCH v4 0/2] PVH GDT fixes Boris Ostrovsky
2018-05-22 3:54 ` [PATCH v4 1/2] xen/PVH: Set up GS segment for stack canary Boris Ostrovsky
2018-05-22 10:13 ` Jan Beulich
2018-05-22 13:45 ` Brian Gerst
2018-05-22 13:57 ` Jan Beulich
2018-05-22 15:15 ` Brian Gerst
2018-05-22 16:10 ` Jan Beulich [this message]
2018-05-22 16:20 ` Boris Ostrovsky
2018-05-22 16:32 ` Jan Beulich
2018-05-22 17:10 ` Boris Ostrovsky
2018-05-23 7:17 ` Jan Beulich
2018-05-23 12:54 ` Juergen Gross
2018-05-22 3:54 ` [PATCH v4 2/2] xen/PVH: Make GDT selectors PVH-specific Boris Ostrovsky
2018-05-23 12:58 ` Juergen Gross
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=5B04410D02000078001C4CC5@prv1-mh.provo.novell.com \
--to=jbeulich@suse.com \
--cc=boris.ostrovsky@oracle.com \
--cc=brgerst@gmail.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xen-devel@lists.xenproject.org \
/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
all inboxes | Powered by JetHome®