Re: [PATCH 1/4] x86: entry.S: tidy up several suboptimal insns

H. Peter Anvin
2015-02-25T09:27:56Z

On 02/25/2015 01:20 AM, Ingo Molnar wrote:
>
> I think the fundamental fragility is that we allow the high
> 32 bits to be nonzero.
>
> So could we just zap the high 32 bits of RAX early in the
> entry code, and then from that point on we could both use
> 32-bit ops and won't have to remember the possibility
> either?
>

We do that, but people keep "optimizing" the zero extend away. We have
had this cause a wide-open security hole twice already. So the extra
REX prefix is a cheap cost to avoid this happen again.

-hpa