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:   Tue, 29 Sep 2020 12:25:12 +0200
From:   Borislav Petkov <bp@...en8.de>
To:     Dan Williams <dan.j.williams@...el.com>
Cc:     mingo@...hat.com, x86@...nel.org, stable@...r.kernel.org,
        "H. Peter Anvin" <hpa@...or.com>,
        Paul Mackerras <paulus@...ba.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Peter Zijlstra <peterz@...radead.org>,
        Mikulas Patocka <mpatocka@...hat.com>,
        Alexander Viro <viro@...iv.linux.org.uk>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Tony Luck <tony.luck@...el.com>,
        Michael Ellerman <mpe@...erman.id.au>,
        linux-nvdimm@...ts.01.org, linux-kernel@...r.kernel.org,
        jack@...e.cz
Subject: Re: [PATCH v9 1/2] x86, powerpc: Rename memcpy_mcsafe() to
 copy_mc_to_{user, kernel}()

On Wed, Sep 23, 2020 at 09:41:33AM -0700, Dan Williams wrote:
> The rename replaces a single top-level memcpy_mcsafe() with either
> copy_mc_to_user(), or copy_mc_to_kernel().

What is "copy_mc" supposed to mean? Especially if it is called that on
two arches...

> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 7101ac64bb20..e876b3a087f9 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -75,7 +75,7 @@ config X86
>  	select ARCH_HAS_PTE_DEVMAP		if X86_64
>  	select ARCH_HAS_PTE_SPECIAL
>  	select ARCH_HAS_UACCESS_FLUSHCACHE	if X86_64
> -	select ARCH_HAS_UACCESS_MCSAFE		if X86_64 && X86_MCE
> +	select ARCH_HAS_COPY_MC			if X86_64

X86_MCE is dropped here. So if I have a build which has

# CONFIG_X86_MCE is not set

One of those quirks like:

        /*
         * CAPID0{7:6} indicate whether this is an advanced RAS SKU
         * CAPID5{8:5} indicate that various NVDIMM usage modes are
         * enabled, so memory machine check recovery is also enabled.
         */
        if ((capid0 & 0xc0) == 0xc0 || (capid5 & 0x1e0))
                enable_copy_mc_fragile();

will still call enable_copy_mc_fragile() and none of those platforms
need MCE functionality?

But there's a hunk in here which sets it in the MCE code:

        if (mca_cfg.recovery)
                enable_copy_mc_fragile();

So which is it? They need it or they don't?

The comment over copy_mc_to_kernel() says:

 * Call into the 'fragile' version on systems that have trouble
 * actually do machine check recovery

If CONFIG_X86_MCE is not set, I'll say. :)

> +++ b/arch/x86/lib/copy_mc.c
> @@ -0,0 +1,66 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/* Copyright(c) 2016-2020 Intel Corporation. All rights reserved. */
> +
> +#include <linux/jump_label.h>
> +#include <linux/uaccess.h>
> +#include <linux/export.h>
> +#include <linux/string.h>
> +#include <linux/types.h>
> +
> +static DEFINE_STATIC_KEY_FALSE(copy_mc_fragile_key);
> +
> +void enable_copy_mc_fragile(void)
> +{
> +	static_branch_inc(&copy_mc_fragile_key);
> +}
> +
> +/**
> + * copy_mc_to_kernel - memory copy that that handles source exceptions

One "that" is enough.

...

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ