x86/bugs: Do not enable IBPB-on-entry when IBPB is not supported
authorThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Thu, 7 Jul 2022 16:41:52 +0000 (13:41 -0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Jul 2022 10:54:10 +0000 (12:54 +0200)
commit3653093b7bbfa8c8c61858bffdc7f1e41ad436e1
tree5937dd22f36211b77504a18cc644376df5759cb3
parent925340f99bdfd747bcb6950d5576224fd75dc103
x86/bugs: Do not enable IBPB-on-entry when IBPB is not supported

commit 2259da159fbe5dba8ac00b560cf00b6a6537fa18 upstream.

There are some VM configurations which have Skylake model but do not
support IBPB. In those cases, when using retbleed=ibpb, userspace is going
to be killed and kernel is going to panic.

If the CPU does not support IBPB, warn and proceed with the auto option. Also,
do not fallback to IBPB on AMD/Hygon systems if it is not supported.

Fixes: 3ebc17006888 ("x86/bugs: Add retbleed=ibpb")
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/cpu/bugs.c