All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
	Tim Deegan <tim@xen.org>, Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH 3/7] x86/mm: Further restrict permissions on some virtual mappings
Date: Wed, 03 May 2017 02:49:09 -0600	[thread overview]
Message-ID: <5909B5A50200007800156294@prv-mh.provo.novell.com> (raw)
In-Reply-To: <1493748326-9582-4-git-send-email-andrew.cooper3@citrix.com>

>>> On 02.05.17 at 20:05, <andrew.cooper3@citrix.com> wrote:
> As originally reported, the Linear Pagetable slot maps 512GB of ram as RWX,
> where the guest has full read access and a lot of direct or indirect control
> over the written content.  It isn't hard for a PV guest to hide shellcode
> here.
> 
> Therefore, increase defence in depth by auditing our current pagetable
> mappings.
> 
>  * The regular linear, shadow linear, and per-domain slots have no business
>    being executable (but need to be written), so are updated to be NX.
>  * The Read Only mappings of the M2P (compat and regular) don't need to be
>    writeable or executable.
>  * The PV GDT mappings don't need to be executable.
> 
> Reported-by: Jann Horn <jannh@google.com>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>
with two remarks:

> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -384,7 +384,7 @@ void __init arch_init_memory(void)
>                      for ( ; i < L3_PAGETABLE_ENTRIES; ++i )
>                          l3tab[i] = l3e_empty();
>                      split_l4e = l4e_from_pfn(virt_to_mfn(l3tab),
> -                                             __PAGE_HYPERVISOR);
> +                                             __PAGE_HYPERVISOR_RW);

Would be nice if this change (affecting the direct map) was also
mentioned in the commit message, even if it's only debugging
code.

> @@ -515,7 +515,7 @@ void __init paging_init(void)
>              l3_ro_mpt = page_to_virt(l3_pg);
>              clear_page(l3_ro_mpt);
>              l4e_write(&idle_pg_table[l4_table_offset(va)],
> -                      l4e_from_page(l3_pg, __PAGE_HYPERVISOR));
> +                      l4e_from_page(l3_pg, __PAGE_HYPERVISOR_RW));

Similarly here (again affecting the direct map).

Jan


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

  reply	other threads:[~2017-05-03  8:49 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-02 18:05 [PATCH 0/7] XSAs 213-315 followups Andrew Cooper
2017-05-02 18:05 ` [PATCH 1/7] x86/traps: Drop 32bit fields out of tss_struct Andrew Cooper
2017-05-03  8:10   ` Jan Beulich
2017-05-03 12:33     ` Andrew Cooper
2017-05-03  9:48   ` Wei Liu
2017-05-02 18:05 ` [PATCH 2/7] x86/traps: Poison unused stack pointers in the TSS Andrew Cooper
2017-05-03  8:14   ` Jan Beulich
2017-05-03 12:47     ` Andrew Cooper
2017-05-03 13:29   ` [PATCH v2 " Andrew Cooper
2017-05-03 13:45     ` Jan Beulich
2017-05-02 18:05 ` [PATCH 3/7] x86/mm: Further restrict permissions on some virtual mappings Andrew Cooper
2017-05-03  8:49   ` Jan Beulich [this message]
2017-05-03 13:38     ` Andrew Cooper
2017-05-03 13:48       ` Jan Beulich
2017-05-03  9:48   ` Wei Liu
2017-05-03 10:11   ` Tim Deegan
2017-05-03 11:13   ` George Dunlap
2017-05-02 18:05 ` [PATCH 4/7] x86/traps: Rename compat_hypercall() to entry_int82() Andrew Cooper
2017-05-03  8:55   ` Jan Beulich
2017-05-03 13:41     ` Andrew Cooper
2017-05-02 18:05 ` [PATCH 5/7] x86/traps: Lift all non-entrypoint logic in entry_int82() up into C Andrew Cooper
2017-05-03  9:02   ` Jan Beulich
2017-05-03 11:26     ` Wei Liu
2017-05-03 11:38       ` Andrew Cooper
2017-05-03 11:43         ` Wei Liu
2017-05-03 12:02         ` Jan Beulich
2017-05-03 12:18           ` Andrew Cooper
2017-05-03 12:37             ` Jan Beulich
2017-05-03 18:29               ` Andrew Cooper
2017-05-04  7:27                 ` Jan Beulich
2017-05-04  9:27                   ` Andrew Cooper
2017-05-04  9:36                     ` Jan Beulich
2017-05-04  9:57                       ` Andrew Cooper
2017-05-03 12:00       ` Jan Beulich
2017-05-04 10:01     ` [PATCH v2 " Andrew Cooper
2017-05-04 10:16       ` Andrew Cooper
2017-05-04 10:28         ` Jan Beulich
2017-05-04 11:09           ` Andrew Cooper
2017-05-04 10:22       ` Jan Beulich
2017-05-02 18:05 ` [PATCH 6/7] x86/asm: Fold LOAD_C_CLOBBERED into RESTORE_ALL Andrew Cooper
2017-05-03  9:08   ` Jan Beulich
2017-05-03  9:48   ` Wei Liu
2017-05-02 18:05 ` [PATCH 7/7] x86/asm: Clobber %r{8..15} on exit to 32bit PV guests Andrew Cooper
2017-05-03  9:13   ` Jan Beulich
2017-05-03 17:51     ` [PATCH v2 " Andrew Cooper
2017-05-04  8:50       ` Jan Beulich
2017-05-04 11:11 ` [RFC for 4.9] [PATCH 0/7] XSAs 213-315 followups Andrew Cooper
2017-05-04 12:52   ` Julien Grall

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=5909B5A50200007800156294@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.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.