aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/include/asm
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2022-09-21 20:10:10 -0700
committerBorislav Petkov <bp@suse.de>2022-09-23 13:46:26 +0200
commit712f210a457d9c32414df246a72781550bc23ef6 (patch)
tree86b2cc803573d0b26bff74b8aeb41ba2e76bee37 /arch/x86/include/asm
parentx86/microcode: Print previous version of microcode after reload (diff)
downloadlinux-dev-712f210a457d9c32414df246a72781550bc23ef6.tar.xz
linux-dev-712f210a457d9c32414df246a72781550bc23ef6.zip
x86/microcode/AMD: Track patch allocation size explicitly
In preparation for reducing the use of ksize(), record the actual allocation size for later memcpy(). This avoids copying extra (uninitialized!) bytes into the patch buffer when the requested allocation size isn't exactly the size of a kmalloc bucket. Additionally, fix potential future issues where runtime bounds checking will notice that the buffer was allocated to a smaller value than returned by ksize(). Fixes: 757885e94a22 ("x86, microcode, amd: Early microcode patch loading support for AMD") Suggested-by: Daniel Micay <danielmicay@gmail.com> Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Borislav Petkov <bp@suse.de> Link: https://lore.kernel.org/lkml/CA+DvKQ+bp7Y7gmaVhacjv9uF6Ar-o4tet872h4Q8RPYPJjcJQA@mail.gmail.com/
Diffstat (limited to 'arch/x86/include/asm')
-rw-r--r--arch/x86/include/asm/microcode.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/arch/x86/include/asm/microcode.h b/arch/x86/include/asm/microcode.h
index 7f7800e15ed0..74ecc2bd6cd0 100644
--- a/arch/x86/include/asm/microcode.h
+++ b/arch/x86/include/asm/microcode.h
@@ -9,6 +9,7 @@
struct ucode_patch {
struct list_head plist;
void *data; /* Intel uses only this one */
+ unsigned int size;
u32 patch_id;
u16 equiv_cpu;
};