From: Jan Beulich <jbeulich@suse.com>
To: Juergen Gross <jgross@suse.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: "Stefano Stabellini" <sstabellini@kernel.org>,
lkml <linux-kernel@vger.kernel.org>,
"Roger Pau Monné" <roger.pau@citrix.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: [PATCH v2 1/9] xen/x86: prevent PVH type from getting clobbered
Date: Thu, 30 Sep 2021 14:16:15 +0200 [thread overview]
Message-ID: <d301677b-6f22-5ae6-bd36-458e1f323d0b@suse.com> (raw)
In-Reply-To: <9a26d4ff-80a1-e0c1-f528-31a8568d41f7@suse.com>
Like xen_start_flags, xen_domain_type gets set before .bss gets cleared.
Hence this variable also needs to be prevented from getting put in .bss,
which is possible because XEN_NATIVE is an enumerator evaluating to
zero. Any use prior to init_hvm_pv_info() setting the variable again
would lead to wrong decisions; one such case is xenboot_console_setup()
when called as a result of "earlyprintk=xen".
Use __ro_after_init as more applicable than either __section(".data") or
__read_mostly.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -52,9 +52,6 @@ DEFINE_PER_CPU(struct vcpu_info, xen_vcp
DEFINE_PER_CPU(uint32_t, xen_vcpu_id);
EXPORT_PER_CPU_SYMBOL(xen_vcpu_id);
-enum xen_domain_type xen_domain_type = XEN_NATIVE;
-EXPORT_SYMBOL_GPL(xen_domain_type);
-
unsigned long *machine_to_phys_mapping = (void *)MACH2PHYS_VIRT_START;
EXPORT_SYMBOL(machine_to_phys_mapping);
unsigned long machine_to_phys_nr;
@@ -69,9 +66,11 @@ __read_mostly int xen_have_vector_callba
EXPORT_SYMBOL_GPL(xen_have_vector_callback);
/*
- * NB: needs to live in .data because it's used by xen_prepare_pvh which runs
- * before clearing the bss.
+ * NB: These need to live in .data or alike because they're used by
+ * xen_prepare_pvh() which runs before clearing the bss.
*/
+enum xen_domain_type __ro_after_init xen_domain_type = XEN_NATIVE;
+EXPORT_SYMBOL_GPL(xen_domain_type);
uint32_t xen_start_flags __section(".data") = 0;
EXPORT_SYMBOL(xen_start_flags);
next prev parent reply other threads:[~2021-09-30 12:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-30 12:12 [PATCH v2 0/9] xen/x86: PVH Dom0 fixes and fallout adjustments Jan Beulich
2021-09-30 12:16 ` Jan Beulich [this message]
2021-09-30 12:16 ` [PATCH v2 2/9] xen/x86: allow PVH Dom0 without XEN_PV=y Jan Beulich
2021-09-30 12:17 ` [PATCH v2 3/9] xen/x86: make "earlyprintk=xen" work better for PVH Dom0 Jan Beulich
2021-09-30 12:18 ` [PATCH v2 4/9] xen/x86: allow "earlyprintk=xen" to work for PV Dom0 Jan Beulich
2021-09-30 12:18 ` [PATCH v2 5/9] xen/x86: make "earlyprintk=xen" work for HVM/PVH DomU Jan Beulich
2021-09-30 12:19 ` [PATCH v2 6/9] xen/x86: generalize preferred console model from PV to PVH Dom0 Jan Beulich
2021-09-30 12:19 ` [PATCH v2 7/9] xen/x86: hook up xen_banner() also for PVH Jan Beulich
2021-09-30 12:45 ` Juergen Gross
2021-09-30 12:20 ` [PATCH v2 8/9] x86/PVH: adjust function/data placement Jan Beulich
2021-09-30 12:21 ` [PATCH v2 9/9] xen/x86: adjust data placement Jan Beulich
2021-09-30 12:45 ` Juergen Gross
2021-10-05 6:38 ` [PATCH v2 0/9] xen/x86: PVH Dom0 fixes and fallout adjustments 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=d301677b-6f22-5ae6-bd36-458e1f323d0b@suse.com \
--to=jbeulich@suse.com \
--cc=boris.ostrovsky@oracle.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=roger.pau@citrix.com \
--cc=sstabellini@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;
as well as URLs for NNTP newsgroup(s).