All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>,
	"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH v2 2/2] x86/xpti: Don't leak TSS-adjacent percpu data via Meltdown
Date: Mon, 29 Jul 2019 17:02:39 +0100	[thread overview]
Message-ID: <e07bd3da-eec6-ff4c-7771-9899d2ccba5b@citrix.com> (raw)
In-Reply-To: <d13d7b00-e040-6aad-cfbf-f51c4ab5e709@citrix.com>

On 29/07/2019 16:55, Andrew Cooper wrote:
>>> --- a/xen/include/asm-x86/processor.h
>>> +++ b/xen/include/asm-x86/processor.h
>>> @@ -411,7 +411,7 @@ static always_inline void __mwait(unsigned long eax, unsigned long ecx)
>>>   #define IOBMP_BYTES             8192
>>>   #define IOBMP_INVALID_OFFSET    0x8000
>>>   
>>> -struct __packed __cacheline_aligned tss_struct {
>>> +struct __packed tss_struct {
>>>       uint32_t :32;
>>>       uint64_t rsp0, rsp1, rsp2;
>>>       uint64_t :64;
>>> @@ -425,6 +425,7 @@ struct __packed __cacheline_aligned tss_struct {
>>>       /* Pads the TSS to be cacheline-aligned (total size is 0x80). */
>>>       uint8_t __cacheline_filler[24];
>>>   };
>>> +DECLARE_PER_CPU(struct tss_struct, init_tss);
>> Taking patch 1 this expands to
>>
>>      __DEFINE_PER_CPU(__section(".bss.percpu.page_aligned") \
>>                       __aligned(PAGE_SIZE), struct tss_struct, _init_tss);
>>
>> and then
>>
>>      __section(".bss.percpu.page_aligned") __aligned(PAGE_SIZE)
>>      __typeof__(struct tss_struct) per_cpu__init_tss;
>>
>> which is not what you want: You have an object of size
>> sizeof(struct tss_struct) which is PAGE_SIZE aligned. Afaict you
>> therefore still leak everything that follows in the same page.
> What data might this be?
>
> Every object put into this section is suitably aligned, so nothing will
> sit in the slack between the TSS and the end of the page.

And of course, I should have actually checked...

ffff82d08092e000 B per_cpu__init_tss
ffff82d08092e000 B __per_cpu_start
ffff82d08092e080 B per_cpu__cpupool
ffff82d08092e088 b per_cpu__continue_info

This needs fixing with suitable alignment in the linker script.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-07-29 16:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-26 20:32 [Xen-devel] [PATCH v2 0/2] x86/xpti: Don't leak TSS-adjacent percpu data via Meltdown Andrew Cooper
2019-07-26 20:32 ` [Xen-devel] [PATCH v2 1/2] xen/link: Introduce .bss.percpu.page_aligned Andrew Cooper
2019-07-26 21:39   ` Julien Grall
2019-07-29  8:52   ` Roger Pau Monné
2019-07-29  9:01     ` Andrew Cooper
2019-07-29 13:17   ` Jan Beulich
2019-07-29 15:01     ` Andrew Cooper
2019-07-26 20:32 ` [Xen-devel] [PATCH v2 2/2] x86/xpti: Don't leak TSS-adjacent percpu data via Meltdown Andrew Cooper
2019-07-29  8:53   ` Roger Pau Monné
2019-07-29 13:51   ` Jan Beulich
2019-07-29 15:55     ` Andrew Cooper
2019-07-29 16:02       ` Andrew Cooper [this message]
2019-07-29 16:07       ` 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=e07bd3da-eec6-ff4c-7771-9899d2ccba5b@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.