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.

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
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

op updated this revision to Diff 22115.Nov 9 2016, 9:12 PM
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.
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'

kib edited edge metadata.Nov 10 2016, 7:05 PM

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 updated this revision to Diff 22136.Nov 10 2016, 11:26 PM
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 as the repository for this revision.

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

op set the repository for this revision to rS FreeBSD src repository.Nov 10 2016, 11:27 PM
This revision was automatically updated to reflect the committed changes.