lkml.org 
[lkml]   [2013]   [Apr]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] x86: Sanity-check static_cpu_has usage
On 04/29/2013 07:04 AM, Borislav Petkov wrote:
> From: Borislav Petkov <bp@suse.de>
>
> static_cpu_has may be used only after alternatives have run. Before that
> it always returns false if constant folding with __builtin_constant_p()
> doesn't happen. And you don't want that.
>
> This patch is the result of me debugging an issue where I overzealously
> put static_cpu_has in code which executed before alternatives have run
> and had to spend some time with scratching head and cursing at the
> monitor.
>
> So add a jump to a warning which screams loudly when we use this
> function too early. The alternatives patch that check away in
> conjunction with patching the rest of the kernel image.
>
> This first JMP the compiler then issues should always be a two-byte JMP
> because its relative offset fits in a byte. This gets replaced by only a
> two-byte NOP => less instruction cache bloat.
>

I still would prefer this to be an option.

-hpa




\
 
 \ /
  Last update: 2013-04-29 18:01    [W:0.407 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site