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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 4 Apr 2019 18:31:37 +0200
From:   Jann Horn <jannh@...gle.com>
To:     Borislav Petkov <bp@...en8.de>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        "H. Peter Anvin" <hpa@...or.com>,
        "the arch/x86 maintainers" <x86@...nel.org>,
        kernel list <linux-kernel@...r.kernel.org>,
        David Laight <David.Laight@...lab.com>
Subject: Re: [PATCH] x86/microcode: Refactor Intel microcode loading

On Thu, Apr 4, 2019 at 6:28 PM Borislav Petkov <bp@...en8.de> wrote:
>
> On Thu, Apr 04, 2019 at 01:11:28PM +0200, Jann Horn wrote:
> > This changes generic_load_microcode() to use the iov_iter API instead of
> > an open-coded version. This allows us to avoid explicitly casting between
> > user and kernel pointers.
> >
> > Because the iov_iter API makes it hard to read the same location twice, as
> > a side effect, this also fixes a double-read of the microcode header (which
> > could e.g. lead to out-of-bounds reads in microcode_sanity_check()).
> > Not that it matters much, only root can do this anyway...
> >
> > Signed-off-by: Jann Horn <jannh@...gle.com>
> > ---
> > I have tested that with this patch applied, microcode loading still works
> > both via "iucode-tool -k" and via
> > /sys/devices/system/cpu/microcode/reload.
>
> Yeah, this cannot have worked because I think I broke it recently and
> you'd need this:

Uuuh. I *definitely* tested this. I ran this yesterday evening on my
home machine, on top of commit
14c741de93861749dfb60b4964028541f5c506ca from Linus' tree, plus two
cherry-picked fixes for drm/ttm. I specifically made sure that I had
the old microcode version before reloading these ways and I had the
new version after reloading. And the verbose dmesg logs also looked
okay.

> ---
> diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
> index 5260185cbf7b..8a4a7823451a 100644
> --- a/arch/x86/kernel/cpu/microcode/core.c
> +++ b/arch/x86/kernel/cpu/microcode/core.c
> @@ -418,8 +418,9 @@ static int do_microcode_update(const void __user *buf, size_t size)
>                 if (ustate == UCODE_ERROR) {
>                         error = -1;
>                         break;
> -               } else if (ustate == UCODE_OK)
> +               } else if (ustate == UCODE_NEW) {
>                         apply_microcode_on_target(cpu);
> +               }
>         }
>
>         return error;
> ---
>
> Regardless, I'll take care of it. Thanks a lot for doing this cleanup,
> it looks really cool and nicely clean - exactly how I envisioned it. :-)
>
> I'll test it more later with the above fix and apply it.
>
> Thx.
>
> --
> Regards/Gruss,
>     Boris.
>
> Good mailing practices for 400: avoid top-posting and trim the reply.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ