From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
To: Borislav Petkov <bp@alien8.de>
Cc: Chris Bainbridge <chris.bainbridge@gmail.com>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/microcode: Change checksum to u32
Date: Sat, 27 Feb 2016 17:12:59 -0300 [thread overview]
Message-ID: <20160227201259.GD19798@khazad-dum.debian.net> (raw)
In-Reply-To: <20160227175118.GC5261@pd.tnic>
On Sat, 27 Feb 2016, Borislav Petkov wrote:
> * sum is computed here:
>
> sum = orig_sum
> - (mc_header->sig + mc_header->pf + mc_header->cksum)
> + (ext_sig->sig + ext_sig->pf + ext_sig->cksum);
Well, orig_sum is always zero, because we exit early when it isn't. sum
really ought to be u32 in the first place (the only reason the code works is
because gcc isn't that insane), and the other fields should have been cast
to u32 as well before being added, for clarity if nothing else.
> and it adds a bunch of integers which can overflow, sure, but if it
> overflows, we exit early.
There is no reason why "sig + pf + cksum" wouldn't overflow 32 bits... in
fact, they often (always?) do on valid microcode.
And we need all of the intel-microcode-checksum-related arithmetic to be
done modulo-2^32, because it is expected to overflow *and* warp around when
it does so.
--
"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
next prev parent reply other threads:[~2016-02-27 20:13 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-27 11:01 [PATCH] x86/microcode: Change checksum to u32 Chris Bainbridge
2016-02-27 17:51 ` Borislav Petkov
2016-02-27 18:23 ` Chris Bainbridge
2016-02-27 19:44 ` Henrique de Moraes Holschuh
2016-02-27 22:29 ` Borislav Petkov
2016-02-27 20:12 ` Henrique de Moraes Holschuh [this message]
2016-03-16 10:52 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160227201259.GD19798@khazad-dum.debian.net \
--to=hmh@hmh.eng.br \
--cc=bp@alien8.de \
--cc=chris.bainbridge@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox