xen/x86: prevent PVH type from getting clobbered
authorJan Beulich <jbeulich@suse.com>
Thu, 30 Sep 2021 12:16:15 +0000 (14:16 +0200)
committerJuergen Gross <jgross@suse.com>
Tue, 5 Oct 2021 06:35:48 +0000 (08:35 +0200)
commit9172b5c4a778da1f855b2e3780b1afabb3cfd523
treede8a256131f75e448785967fbcba9bad15f907d4
parent97315723c463679a9ecf803d6479fca24c3efda0
xen/x86: prevent PVH type from getting clobbered

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>
arch/x86/xen/enlighten.c