Hi Sasha, These build issues can be fixed by including linux/nospec.h to arch/x86/kvm/mtrr.c. Below you can find a patch that compiles on both v4.9.206 and v4.4.206. Please let me know if you need anything else. Marios ======== diff --git a/arch/x86/kvm/mtrr.c b/arch/x86/kvm/mtrr.c index 0149ac59c273..f223f1315998 100644 --- a/arch/x86/kvm/mtrr.c +++ b/arch/x86/kvm/mtrr.c @@ -18,6 +18,7 @@ #include <linux/kvm_host.h> #include <asm/mtrr.h> +#include <linux/nospec.h> #include "cpuid.h" #include "mmu.h" @@ -202,11 +203,15 @@ static bool fixed_msr_to_seg_unit(u32 msr, int *seg, int *unit) break; case MSR_MTRRfix16K_80000 ... MSR_MTRRfix16K_A0000: *seg = 1; - *unit = msr - MSR_MTRRfix16K_80000; + *unit = array_index_nospec( + msr - MSR_MTRRfix16K_80000, + MSR_MTRRfix16K_A0000 - MSR_MTRRfix16K_80000 + 1); break; case MSR_MTRRfix4K_C0000 ... MSR_MTRRfix4K_F8000: *seg = 2; - *unit = msr - MSR_MTRRfix4K_C0000; + *unit = array_index_nospec( + msr - MSR_MTRRfix4K_C0000, + MSR_MTRRfix4K_F8000 - MSR_MTRRfix4K_C0000 + 1); break; default: return false; On Wed, Dec 25, 2019 at 3:55 PM Sasha Levin <sashal@xxxxxxxxxx> wrote: > > Hi, > > [This is an automated email] > > This commit has been processed because it contains a "Fixes:" tag, > fixing commit: de9aef5e1ad6 ("KVM: MTRR: introduce fixed_mtrr_segment table"). > > The bot has tested the following trees: v5.4.5, v5.3.18, v4.19.90, v4.14.159, v4.9.206, v4.4.206. > > v5.4.5: Build OK! > v5.3.18: Build OK! > v4.19.90: Build OK! > v4.14.159: Build OK! > v4.9.206: Build failed! Errors: > arch/x86/kvm/mtrr.c:205:11: error: implicit declaration of function ‘array_index_nospec’; did you mean ‘array_index_mask_nospec’? [-Werror=implicit-function-declaration] > > v4.4.206: Build failed! Errors: > arch/x86/kvm/mtrr.c:205:11: error: implicit declaration of function ‘array_index_nospec’; did you mean ‘array_index_mask_nospec’? [-Werror=implicit-function-declaration] > > > NOTE: The patch will not be queued to stable trees until it is upstream. > > How should we proceed with this patch? > > -- > Thanks, > Sasha -- Marios Pomonis Software Engineer, Security GCP Platform Security US-KIR-6THC