All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Jan Beulich <jbeulich@suse.com>, Juergen Gross <jgross@suse.com>,
	Sasha Levin <sashal@kernel.org>,
	boris.ostrovsky@oracle.com, tglx@linutronix.de, mingo@redhat.com,
	bp@alien8.de, x86@kernel.org, xen-devel@lists.xenproject.org
Subject: [PATCH AUTOSEL 5.10 05/11] xen/x86: prevent PVH type from getting clobbered
Date: Tue, 12 Oct 2021 20:55:25 -0400	[thread overview]
Message-ID: <20211013005532.700190-5-sashal@kernel.org> (raw)
In-Reply-To: <20211013005532.700190-1-sashal@kernel.org>

From: Jan Beulich <jbeulich@suse.com>

[ Upstream commit 9172b5c4a778da1f855b2e3780b1afabb3cfd523 ]

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>

Link: https://lore.kernel.org/r/d301677b-6f22-5ae6-bd36-458e1f323d0b@suse.com
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/x86/xen/enlighten.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index aa9f50fccc5d..0f68c6da7382 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -51,9 +51,6 @@ DEFINE_PER_CPU(struct vcpu_info, xen_vcpu_info);
 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;
@@ -68,9 +65,11 @@ __read_mostly int xen_have_vector_callback;
 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);
 
-- 
2.33.0


  parent reply	other threads:[~2021-10-13  0:56 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-13  0:55 [PATCH AUTOSEL 5.10 01/11] arm: dts: vexpress-v2p-ca9: Fix the SMB unit-address Sasha Levin
2021-10-13  0:55 ` Sasha Levin
2021-10-13  0:55 ` [PATCH AUTOSEL 5.10 02/11] ARM: config: mutli v7: Reenable FB dependency Sasha Levin
2021-10-13  0:55   ` Sasha Levin
2021-10-13  0:55 ` [PATCH AUTOSEL 5.10 03/11] ARM: dts: at91: sama5d2_som1_ek: disable ISC node by default Sasha Levin
2021-10-13  0:55   ` Sasha Levin
2021-10-13  0:55 ` [PATCH AUTOSEL 5.10 04/11] block: decode QUEUE_FLAG_HCTX_ACTIVE in debugfs output Sasha Levin
2021-10-13  0:55 ` Sasha Levin [this message]
2021-10-13  0:55 ` [PATCH AUTOSEL 5.10 06/11] drm/amdgpu/display: fix dependencies for DRM_AMD_DC_SI Sasha Levin
2021-10-13  0:55 ` [PATCH AUTOSEL 5.10 07/11] xtensa: xtfpga: use CONFIG_USE_OF instead of CONFIG_OF Sasha Levin
2021-10-13  0:55 ` [PATCH AUTOSEL 5.10 08/11] xtensa: xtfpga: Try software restart before simulating CPU reset Sasha Levin
2021-10-13  0:55 ` [PATCH AUTOSEL 5.10 09/11] NFSD: Keep existing listeners on portlist error Sasha Levin
2021-10-13  0:55 ` [PATCH AUTOSEL 5.10 10/11] powerpc/security: Add a helper to query stf_barrier type Sasha Levin
2021-10-13  0:55   ` Sasha Levin
2021-10-13  0:55 ` [PATCH AUTOSEL 5.10 11/11] firmware: include drivers/firmware/Kconfig unconditionally Sasha Levin
2021-10-13  0:55   ` Sasha Levin
2021-10-13  0:55   ` Sasha Levin
2021-10-13  0:55   ` Sasha Levin
2021-10-13  5:58   ` Greg KH
2021-10-13  5:58     ` Greg KH
2021-10-13  5:58     ` Greg KH
2021-10-13  5:58     ` Greg KH
2021-10-13  8:38     ` Arnd Bergmann
2021-10-13  8:38       ` Arnd Bergmann
2021-10-13  8:38       ` Arnd Bergmann
2021-10-13  8:38       ` Arnd Bergmann
2021-10-13  8:45       ` Uwe Kleine-König
2021-10-13  8:45         ` Uwe Kleine-König
2021-10-13  8:45         ` Uwe Kleine-König
2021-10-13  8:45         ` Uwe Kleine-König
2021-10-13  8:50         ` Arnd Bergmann
2021-10-13  8:50           ` Arnd Bergmann
2021-10-13  8:50           ` Arnd Bergmann
2021-10-13  8:50           ` Arnd Bergmann

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=20211013005532.700190-5-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@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 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.