Page MenuHomeFreeBSD

increase UCODE_SIZE_MAX from 32kB to 4MB in sys/dev/cpuctl/cpuctl.c to allow microcode update on Intel 6th+ gen CPUs
ClosedPublic

Authored by op on Nov 9 2016, 9:12 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 6, 8:35 AM
Unknown Object (File)
Tue, Apr 2, 12:35 AM
Unknown Object (File)
Feb 10 2024, 5:00 PM
Unknown Object (File)
Jan 31 2024, 4:20 AM
Unknown Object (File)
Jan 31 2024, 4:20 AM
Unknown Object (File)
Dec 22 2023, 10:02 PM
Unknown Object (File)
Dec 21 2023, 4:39 AM
Unknown Object (File)
Nov 19 2023, 3:34 PM

Details

Summary

HBSD: increase UCODE_SIZE_MAX from 32kB to 4MB in sys/dev/cpuctl/cpuctl.c

The lastest microcode update for Intel 6th (Skylake) generation CPU is
bigger than the current hardcoded limit in cpuctl.

-rw-r--r-- 1 root wheel 97280 Nov 9 21:35 m36506e3_0000009d_0000009e.fw
-rw-r--r-- 1 root wheel 97280 Nov 9 21:35 mc0406e3_0000009d_0000009e.fw

So, bump this limit to 4MB, to allow to perform the microcode update.

Tested-on: 10-STABLE + Intel Core i7-6700
Sponsored-by: HardenedBSD Project
FreeBSD-PR: 214369
Signed-off-by: Oliver Pinter <oliver.pinter@hardenedbsd.org>
CC: subbsd@gmail.com
CC: kib@FreeBSD.org
CC: jhb@FreeBSD.org
CC: avg@FreeBSD.org

Test Plan

Apply the patch, recompile the kernel, install the new kernel, and perform the update with cpucontrol -u

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

op retitled this revision from to increase UCODE_SIZE_MAX from 32kB to 128kb in sys/dev/cpuctl/cpuctl.c to allow microcode update on Intel 6th+ gen CPUs.
op updated this object.
op edited the test plan for this revision. (Show Details)
op added reviewers: avg, jhb, kib.
op set the repository for this revision to rS FreeBSD src repository - subversion.
op retitled this revision from increase UCODE_SIZE_MAX from 32kB to 128kb in sys/dev/cpuctl/cpuctl.c to allow microcode update on Intel 6th+ gen CPUs to increase UCODE_SIZE_MAX from 32kB to 128kB in sys/dev/cpuctl/cpuctl.c to allow microcode update on Intel 6th+ gen CPUs.Nov 9 2016, 9:14 PM
op updated this object.

Probably a good idea to make it tunable and also, it would be nice if the system checks the amount of firmware and noticed message about limit exceed, instead of 'Invalid argument'

Probably a good idea to make it tunable and also, it would be nice if the system checks the amount of firmware and noticed message about limit exceed, instead of 'Invalid argument'

I do not see it useful to have the safety belt tunable. Initially, a low value for the constant was a reasonable compromise because contigmalloc(9) was used for firmware image which was supplied to CPU. Some algorithms for vendors used contigmalloc(9) due to misunderstanding, some due to lack or uncertainty in the documentation.

Now I think we only need a safety value, and do not need to help contigmalloc(9). So I think that some large enough value, e.g. 4M, is a good choice to disallow userspace to abuse kernel malloc, while providing good room for future cpu bug vectors.

op retitled this revision from increase UCODE_SIZE_MAX from 32kB to 128kB in sys/dev/cpuctl/cpuctl.c to allow microcode update on Intel 6th+ gen CPUs to increase UCODE_SIZE_MAX from 32kB to 4MB in sys/dev/cpuctl/cpuctl.c to allow microcode update on Intel 6th+ gen CPUs.
op updated this object.
op edited edge metadata.
op removed rS FreeBSD src repository - subversion as the repository for this revision.

Updated the limit to 4MB as proposed by kib@.

This revision was automatically updated to reflect the committed changes.