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: <Y9k0of7zHCzOgTaD@a4bf019067fa.jf.intel.com>
Date:   Tue, 31 Jan 2023 07:32:49 -0800
From:   Ashok Raj <ashok.raj@...el.com>
To:     "Li, Aubrey" <aubrey.li@...ux.intel.com>
CC:     Borislav Petkov <bp@...en8.de>,
        Thomas Gleixner <tglx@...utronix.de>,
        LKML <linux-kernel@...r.kernel.org>, x86 <x86@...nel.org>,
        Ingo Molnar <mingo@...nel.org>,
        Tony Luck <tony.luck@...el.com>,
        Dave Hansen <dave.hansen@...el.com>,
        Alison Schofield <alison.schofield@...el.com>,
        Reinette Chatre <reinette.chatre@...el.com>,
        Tom Lendacky <thomas.lendacky@....com>,
        Stefan Talpalaru <stefantalpalaru@...oo.com>,
        David Woodhouse <dwmw2@...radead.org>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Jonathan Corbet <corbet@....net>,
        "Rafael J . Wysocki" <rafael@...nel.org>,
        Peter Zilstra <peterz@...radead.org>,
        "Andy Lutomirski" <luto@...nel.org>,
        Andrew Cooper <Andrew.Cooper3@...rix.com>,
        Boris Ostrovsky <boris.ostrovsky@...cle.com>,
        Martin Pohlack <mpohlack@...zon.de>,
        Ashok Raj <ashok.raj@...el.com>
Subject: Re: [Patch v3 Part2 1/9] x86/microcode: Taint kernel only if
 microcode loading was successful

On Tue, Jan 31, 2023 at 08:17:25PM +0800, Li, Aubrey wrote:
> On 2023/1/31 5:39, Ashok Raj wrote:
> > Currently when late loading is aborted due to check_online_cpu(), kernel
> > still ends up tainting the kernel.
> > 
> > Taint only when microcode loading was successful.
> > 

[snip]

> > diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
> > index 61d57d9b93ee..1c6831b8b244 100644
> > --- a/arch/x86/kernel/cpu/microcode/core.c
> > +++ b/arch/x86/kernel/cpu/microcode/core.c
> > @@ -472,7 +472,8 @@ static ssize_t reload_store(struct device *dev,
> >   	enum ucode_state tmp_ret = UCODE_OK;
> >   	int bsp = boot_cpu_data.cpu_index;
> >   	unsigned long val;
> > -	ssize_t ret = 0;
> > +	int load_ret = -1;
> > +	ssize_t ret;
> >   	ret = kstrtoul(buf, 0, &val);
> >   	if (ret)
> > @@ -488,20 +489,26 @@ static ssize_t reload_store(struct device *dev,
> >   		goto put;
> >   	tmp_ret = microcode_ops->request_microcode_fw(bsp, &microcode_pdev->dev);
> > -	if (tmp_ret != UCODE_NEW)
> > +	if (tmp_ret != UCODE_NEW) {
> > +		ret = size;
> >   		goto put;
> > +	}
> >   	mutex_lock(&microcode_mutex);
> > -	ret = microcode_reload_late();
> > +	load_ret = microcode_reload_late();
> >   	mutex_unlock(&microcode_mutex);
> >   put:
> >   	cpus_read_unlock();
> > -	if (ret == 0)
> > +	/*
> > +	 * Taint only when loading was successful
> > +	 */
> > +	if (load_ret == 0) {
> >   		ret = size;
> 
> What about if loading was not successful(load_ret != 0)?
> ret has no chance to be returned as size here and we'll run into the endless
> update?

Good catch, we'll need to make that some meaningful return code to stop the
endless wait.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ