When checking for being an hvm domain, or PV domain, we have to make
sure that speculation cannot bypass that check, and eventually access
data that should not end up in cache for the current domain type.
This is part of the speculative hardening effort.
Signed-off-by: Norbert Manthey <nmanthey@amazon.de>
Acked-by: Jan Beulich <jbeulich@suse.com>
static inline bool is_pv_domain(const struct domain *d)
{
- return IS_ENABLED(CONFIG_PV) ? d->guest_type == guest_type_pv : false;
+ return IS_ENABLED(CONFIG_PV)
+ ? evaluate_nospec(d->guest_type == guest_type_pv) : false;
}
static inline bool is_pv_vcpu(const struct vcpu *v)
#endif
static inline bool is_hvm_domain(const struct domain *d)
{
- return IS_ENABLED(CONFIG_HVM) ? d->guest_type == guest_type_hvm : false;
+ return IS_ENABLED(CONFIG_HVM)
+ ? evaluate_nospec(d->guest_type == guest_type_hvm) : false;
}
static inline bool is_hvm_vcpu(const struct vcpu *v)