[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/ucode/amd: Fix potential buffer overrun with equiv table handling
commit 1f97b6b9f1b5978659c5735954c37c130e7bb151 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Fri Mar 27 11:59:02 2020 +0000 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Fri Mar 27 13:13:26 2020 +0000 x86/ucode/amd: Fix potential buffer overrun with equiv table handling find_equiv_cpu_id() loops until it finds a 0 installed_cpu entry. Well formed AMD microcode containers have this property. Extend the checking in install_equiv_cpu_table() to reject tables which don't have a sentinal at the end. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/cpu/microcode/amd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/cpu/microcode/amd.c b/xen/arch/x86/cpu/microcode/amd.c index 122b8309af..96b80ff960 100644 --- a/xen/arch/x86/cpu/microcode/amd.c +++ b/xen/arch/x86/cpu/microcode/amd.c @@ -309,6 +309,7 @@ static int install_equiv_cpu_table( size_t *offset) { const struct mpbhdr *mpbuf = data + *offset + 4; + const struct equiv_cpu_entry *eq; *offset += mpbuf->len + CONT_HDR_SIZE; /* add header length */ @@ -318,7 +319,9 @@ static int install_equiv_cpu_table( return -EINVAL; } - if ( mpbuf->len == 0 ) + if ( mpbuf->len == 0 || mpbuf->len % sizeof(*eq) || + (eq = (const void *)mpbuf->data, + eq[(mpbuf->len / sizeof(*eq)) - 1].installed_cpu) ) { printk(KERN_ERR "microcode: Wrong microcode equivalent cpu table length\n"); return -EINVAL; -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |