Re: BUG: early intel microcode update violating alignment rules

From: Henrique de Moraes Holschuh
Date: Thu Aug 14 2014 - 09:12:42 EST


On Mon, 11 Aug 2014, Bill Davidsen wrote:
> Don't suppose you have anything in memory right after the microcode
> which you could put on the stack (15 bytes) slide the image up into
> alignment, load it, and put everything back. Haven't looked at the
> code or data, just tossing out an idea I used for something else
> back when.

Right after? We don't know what will be there. But we know what is right
before: there's enough bytes worth of microcode metadata header to align the
real microcode data to the previous 16-byte boundary.

This is a fix I should be fully capable of writing, actually. But it will
be slower (two memcpy, two memove) and much nastier than the proper solution
using a scratch area (one memcpy).

That said, it is reported[1] that an Intel microcode update will take
anything from a couple hundred-thousand to several million cycles per
processor core. I wouldn't lose any sleep over adding two 16-byte memcpy
and two ~32KiB memove to something that is already that expensive. And it
will be easy to backport.

Anyway, I don't know enough to either add an initbss, or change the brk as
HPA hinted, or how easy would it be to backport that, so I will wait for
further directions.

Meanwhile, I prepared an iucode-tool v1.0.3 release that works around this
kernel issue for the benefit of the linux distros that use it[2]. It's at
https://gitorious.org/iucode-tool if anyone around here is interested.

[1] http://inertiawar.com/microcode/

[2] Debian, Ubuntu and their derivatives.

--
"One disk to rule them all, One disk to find them. One disk to bring
them all and in the darkness grind them. In the Land of Redmond
where the shadows lie." -- The Silicon Valley Tarot
Henrique Holschuh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/