lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrWhz0c0izNZBV2eE0Be_1i0UOObZ=xOKXxZLgV+EV3CZg@mail.gmail.com>
Date:	Fri, 27 Feb 2015 11:54:33 -0800
From:	Andy Lutomirski <luto@...capital.net>
To:	Steven Rostedt <rostedt@...dmis.org>
Cc:	Linus Torvalds <torvalds@...ux-foundation.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	"Peter Zijlstra (Intel)" <peterz@...radead.org>,
	Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH] x86: Init per-cpu shadow copy of CR4 for i386 too

On Fri, Feb 27, 2015 at 11:50 AM, Steven Rostedt <rostedt@...dmis.org> wrote:
> On Fri, 27 Feb 2015 10:59:52 -0800
> Linus Torvalds <torvalds@...ux-foundation.org> wrote:
>
>> Presumably there is some initialization missing - I suspect that the
>> cached value of cr4 is from the *previous* time the CPU was up, and we
>> don't correctly initialize the cached copy at early CPU bringup.
>
> Found it. The problem is that there's two cpu_init()s in common.c. Andy
> only added the cr4 init to one of them.
>
>
> x86: Init per-cpu shadow copy of CR4 for i386 too
>
> The commit 1e02ce4cccdc "x86: Store a per-cpu shadow copy of CR4" added
> a shadow CR4 such that reads and writes that do not modify the CR4
> execute much faster than always reading the register itself.
> The change modified cpu_init() in common.c, so that the shadow CR4 gets
> initialized before anything uses it. Unfortunately, there's two
> cpu_init()s in common.c. There's one for x86_64 and one for i386. The
> commit only added the shadow init to x86_64. The i386 needs the init
> too.
>
> Link: http://lkml.kernel.org/r/20150227125208.71c36402@gandalf.local.home
> Fixes: 1e02ce4cccdc "x86: Store a per-cpu shadow copy of CR4"
> Signed-off-by: Steven Rostedt <rostedt@...dmis.org>

Looks suspiciously identical to my patch :)

Acked-by: Andy Lutomirski <luto@...capital.net>

> ---
> diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
> index b5c8ff5e9dfc..2346c95c6ab1 100644
> --- a/arch/x86/kernel/cpu/common.c
> +++ b/arch/x86/kernel/cpu/common.c
> @@ -1396,6 +1396,12 @@ void cpu_init(void)
>
>         wait_for_master_cpu(cpu);
>
> +       /*
> +        * Initialize the CR4 shadow before doing anything that could
> +        * try to read it.
> +        */
> +       cr4_init_shadow();
> +
>         show_ucode_info_early();
>
>         printk(KERN_INFO "Initializing CPU#%d\n", cpu);



-- 
Andy Lutomirski
AMA Capital Management, LLC
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ