LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
	Juergen Gross <jgross@suse.com>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [Xen-devel] [PATCH 3/4] xen/PVH: Set up GS segment for stack canary
Date: Wed, 2 May 2018 11:00:30 -0400	[thread overview]
Message-ID: <615b0e30-c360-3ad4-f1b3-0e907d790643@oracle.com> (raw)
In-Reply-To: <5AE973CD02000078001C008E@prv1-mh.provo.novell.com>

On 05/02/2018 04:16 AM, Jan Beulich wrote:
>>>> On 30.04.18 at 18:23, <boris.ostrovsky@oracle.com> wrote:
>> --- a/arch/x86/xen/xen-pvh.S
>> +++ b/arch/x86/xen/xen-pvh.S
>> @@ -54,6 +54,9 @@
>>   * charge of setting up it's own stack, GDT and IDT.
>>   */
>>  
>> +#define PVH_GDT_ENTRY_CANARY    4
>> +#define PVH_CANARY_SEL          (PVH_GDT_ENTRY_CANARY * 8)
> I can only advise against doing it this way: There's no safeguard against
> someone changing asm/segment.h without changing this value (in fact
> this applies to all of the GDT selectors populated in this file). At the very
> least tie this to GDT_ENTRY_BOOT_TSS / __BOOT_TSS?
>
>> @@ -64,6 +67,9 @@ ENTRY(pvh_start_xen)
>>  	mov %eax,%es
>>  	mov %eax,%ss
>>  
>> +	mov $(PVH_CANARY_SEL),%eax
>> +	mov %eax,%gs
>> +
>>  	/* Stash hvm_start_info. */
>>  	mov $_pa(pvh_start_info), %edi
>>  	mov %ebx, %esi
>> @@ -150,6 +156,7 @@ gdt_start:
>>  	.quad 0x00cf9a000000ffff            /* __BOOT_CS */
>>  #endif
>>  	.quad 0x00cf92000000ffff            /* __BOOT_DS */
>> +	.quad 0x0040900000000018            /* PVH_CANARY_SEL */
> Without any further code before loading the selector, this points at
> physical address 0. Don't you need to add in the base address of
> the per-CPU stack_canary?

This GDT is gone soon after we jump into generic x86 startup code.That
code will load its own GDT (and then set up per-cpu segments and all that).

-boris

  reply	other threads:[~2018-05-02 14:57 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-30 16:23 [PATCH 0/4] PVH GDT fixes and cleanup Boris Ostrovsky
2018-04-30 16:23 ` [PATCH 1/4] xen/PVH: Replace GDT_ENTRY with explicit constant Boris Ostrovsky
2018-04-30 16:57   ` [Xen-devel] " Roger Pau Monné
2018-04-30 18:07     ` Boris Ostrovsky
2018-05-01  7:53       ` Roger Pau Monné
2018-05-01 12:16         ` Boris Ostrovsky
2018-05-01 11:31   ` David Laight
2018-05-01 12:40     ` Boris Ostrovsky
2018-05-02  8:00   ` [Xen-devel] " Jan Beulich
2018-05-02 14:53     ` Boris Ostrovsky
2018-04-30 16:23 ` [PATCH 2/4] xen/PVH: Use proper CS selector in long mode Boris Ostrovsky
2018-05-02  8:05   ` [Xen-devel] " Jan Beulich
2018-05-02 14:57     ` Boris Ostrovsky
2018-05-02 15:00       ` Jan Beulich
2018-05-02 15:08         ` Boris Ostrovsky
2018-05-02 15:09           ` Jan Beulich
2018-05-02 15:28             ` Andrew Cooper
2018-04-30 16:23 ` [PATCH 3/4] xen/PVH: Set up GS segment for stack canary Boris Ostrovsky
2018-05-02  8:16   ` [Xen-devel] " Jan Beulich
2018-05-02 15:00     ` Boris Ostrovsky [this message]
2018-05-02 15:01       ` Jan Beulich
2018-05-02 15:22         ` Boris Ostrovsky
2018-05-02 15:41           ` Jan Beulich
2018-05-02 17:29             ` Boris Ostrovsky
2018-05-03  7:35               ` Jan Beulich
2018-04-30 16:23 ` [PATCH 4/4] xen/PVH: Remove reserved entry in PVH GDT Boris Ostrovsky
2018-05-01  8:00   ` [Xen-devel] " Roger Pau Monné
2018-05-01 12:34     ` Boris Ostrovsky
2018-05-02  8:26       ` Jan Beulich
2018-05-02 15:06         ` Boris Ostrovsky
2018-05-02 15:07           ` Jan Beulich
2018-05-02  8:19   ` Jan Beulich

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=615b0e30-c360-3ad4-f1b3-0e907d790643@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    --subject='Re: [Xen-devel] [PATCH 3/4] xen/PVH: Set up GS segment for stack canary' \
    /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

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).