From: "Jan Beulich" <JBeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH] xen/x86: Remap text/data/bss with appropriate permissions
Date: Thu, 17 Mar 2016 08:31:13 -0600 [thread overview]
Message-ID: <56EACDC102000078000DDF03@prv-mh.provo.novell.com> (raw)
In-Reply-To: <1458218596-23847-1-git-send-email-andrew.cooper3@citrix.com>
>>> On 17.03.16 at 13:43, <andrew.cooper3@citrix.com> wrote:
> --- a/xen/arch/x86/setup.c
> +++ b/xen/arch/x86/setup.c
> @@ -529,9 +529,33 @@ static void noinline init_done(void)
> }
> else
> {
> + /* Mark .text as RX (avoiding the first 2M superpage). */
> + map_pages_to_xen(XEN_VIRT_START + MB(2),
> + PFN_DOWN(__pa(XEN_VIRT_START + MB(2))),
> + PFN_DOWN(__2M_text_end -
> + (const char *)(XEN_VIRT_START + MB(2))),
> + PAGE_HYPERVISOR_RX);
> +
> + /* Mark .rodata as RO. */
> + map_pages_to_xen((unsigned long)&__2M_rodata_start,
> + PFN_DOWN(__pa(__2M_rodata_start)),
> + PFN_DOWN(__2M_rodata_end - __2M_rodata_start),
> + PAGE_HYPERVISOR_RO);
> +
> + /* Free and reuse .init. */
> destroy_xen_mappings((unsigned long)&__init_begin,
> (unsigned long)&__init_end);
> init_xenheap_pages(__pa(__init_begin), __pa(__init_end));
> +
> + /* Mark .data and .bss as RW. */
> + map_pages_to_xen((unsigned long)&__2M_rwdata_start,
> + PFN_DOWN(__pa(__2M_rwdata_start)),
> + PFN_DOWN(__2M_rwdata_end - __2M_rwdata_start),
> + PAGE_HYPERVISOR_RW);
> +
> + /* Drop the remaining mappings in the shattered superpage. */
> + destroy_xen_mappings((unsigned long)&__2M_rwdata_end,
> + ROUNDUP((unsigned long)&__2M_rwdata_end, MB(2)));
> }
I think this would be more appropriate to add to some __init
function (which the discarding of .init.* naturally can't live in).
Also - do we really want to make this code dependent on
map_pages_to_xen() not intermediately zapping the mappings
being changed?
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-03-17 14:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-17 12:43 [PATCH] xen/x86: Remap text/data/bss with appropriate permissions Andrew Cooper
2016-03-17 12:43 ` [PATCH] DO NOT APPLY - debug keys for inspecting Xen mappings Andrew Cooper
2016-03-17 14:31 ` Jan Beulich [this message]
2016-03-17 14:44 ` [PATCH] xen/x86: Remap text/data/bss with appropriate permissions Andrew Cooper
2016-03-17 15:32 ` Jan Beulich
2016-03-17 16:15 ` Andrew Cooper
2016-03-18 7:25 ` Jan Beulich
2016-03-18 19:49 ` [PATCH v2] " Andrew Cooper
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=56EACDC102000078000DDF03@prv-mh.provo.novell.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--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 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).