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]
Date:   Wed, 7 Sep 2016 13:36:40 +0200
From:   Borislav Petkov <bp@...en8.de>
To:     Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc:     linux-kernel@...r.kernel.org,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>, rt@...utronix.de,
        tglx@...utronix.de
Subject: Re: [PATCH 06/21] x86: microcode: Convert to hotplug state machine

On Tue, Sep 06, 2016 at 07:04:42PM +0200, Sebastian Andrzej Siewior wrote:
> Install the callbacks via the state machine. There is little hackery with
> mc_cpu_dead() which should only be called if CPU_UP failed durin resume.
> This change may not fully represent the current behaviour. The current code
> also behaves different if the CPU does not come up in the _cpu_up() state vs
> one of the CPU_ONLINE notifier returned an error. Not sure what kind of a
> problem is solved here.

You mean this:

        /* The CPU refused to come up during a system resume */
        if (action == CPU_UP_CANCELED_FROZEN)
                microcode_fini_cpu(cpu);

?

It clears internal state, i.e., invalidates the current microcode patch.

> 
> Cc: Borislav Petkov <bp@...en8.de>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
> ---
>  arch/x86/kernel/cpu/microcode/core.c | 71 +++++++++++++++---------------------
>  include/linux/cpuhotplug.h           |  1 +
>  2 files changed, 30 insertions(+), 42 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
> index df04b2d033f6..4fc67b51e22e 100644
> --- a/arch/x86/kernel/cpu/microcode/core.c
> +++ b/arch/x86/kernel/cpu/microcode/core.c

...

> -static struct notifier_block mc_cpu_notifier = {
> -	.notifier_call	= mc_cpu_callback,
> -};
> +static int mc_cpu_down_prep(unsigned int cpu)
> +{
> +	struct device *dev;
> +
> +	dev = get_cpu_device(cpu);
> +	/* Suspend is in progress, only remove the interface */
> +	sysfs_remove_group(&dev->kobj, &mc_attr_group);
> +	pr_debug("CPU%d removed\n", cpu);
> +	return 0;
> +}
> +
> +static int mc_cpu_dead(unsigned int cpu)
> +{
> +#ifdef CONFIG_SMP
> +	if (cpuhp_tasks_frozen)
> +		microcode_fini_cpu(cpu);
> +#endif
> +	return 0;
> +}

If this is corresponding to CPU_DEAD, then I'd like to point to that comment:

        /*
         * case CPU_DEAD:
         *
         * When a CPU goes offline, don't free up or invalidate the copy of
         * the microcode in kernel memory, so that we can reuse it when the
         * CPU comes back online without unnecessarily requesting the userspace
         * for it again.
         */

IOW, you don't need mc_cpu_dead().

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ