Message ID | 20240410192659.1490271-1-andrew.cooper3@citrix.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | xen/nospec: Remove unreachable code | expand |
> On 10 Apr 2024, at 20:26, Andrew Cooper <andrew.cooper3@citrix.com> wrote: > > When CONFIG_SPECULATIVE_HARDEN_LOCK is active, this reads: > > static always_inline bool lock_evaluate_nospec(bool condition) > { > return arch_lock_evaluate_nospec(condition); > return condition; > } > > Insert an #else to take out the second return. > > Fixes: 7ef0084418e1 ("x86/spinlock: introduce support for blocking speculation into critical regions") > Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> > --- Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>
On Wed, 10 Apr 2024, Andrew Cooper wrote: > When CONFIG_SPECULATIVE_HARDEN_LOCK is active, this reads: > > static always_inline bool lock_evaluate_nospec(bool condition) > { > return arch_lock_evaluate_nospec(condition); > return condition; > } > > Insert an #else to take out the second return. > > Fixes: 7ef0084418e1 ("x86/spinlock: introduce support for blocking speculation into critical regions") > Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
diff --git a/xen/include/xen/nospec.h b/xen/include/xen/nospec.h index 9fb15aa26aa9..828dbd4e0ad8 100644 --- a/xen/include/xen/nospec.h +++ b/xen/include/xen/nospec.h @@ -82,8 +82,9 @@ static always_inline bool lock_evaluate_nospec(bool condition) { #ifdef CONFIG_SPECULATIVE_HARDEN_LOCK return arch_lock_evaluate_nospec(condition); -#endif +#else return condition; +#endif } #endif /* XEN_NOSPEC_H */
When CONFIG_SPECULATIVE_HARDEN_LOCK is active, this reads: static always_inline bool lock_evaluate_nospec(bool condition) { return arch_lock_evaluate_nospec(condition); return condition; } Insert an #else to take out the second return. Fixes: 7ef0084418e1 ("x86/spinlock: introduce support for blocking speculation into critical regions") Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> --- CC: Jan Beulich <JBeulich@suse.com> CC: Roger Pau Monné <roger.pau@citrix.com> CC: Stefano Stabellini <sstabellini@kernel.org> CC: consulting@bugseng.com <consulting@bugseng.com> CC: Roberto Bagnara <roberto.bagnara@bugseng.com> CC: Federico Serafini <federico.serafini@bugseng.com> CC: Nicola Vetrini <nicola.vetrini@bugseng.com> --- xen/include/xen/nospec.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) base-commit: 0e7ea8ca5fc9bce9248414f6aaf2dc861abd45d9