[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y9reDitxHgzcrsOY@a4bf019067fa.jf.intel.com>
Date: Wed, 1 Feb 2023 13:47:58 -0800
From: Ashok Raj <ashok.raj@...el.com>
To: Borislav Petkov <bp@...en8.de>
CC: 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>,
"Li, Aubrey" <aubrey.li@...el.com>, Ashok Raj <ashok.raj@...el.com>
Subject: Re: [Patch v3 Part2 1/9] x86/microcode: Taint kernel only if
microcode loading was successful
Hi Boris,
While reworking I thought while at this, there is a chance to fix other
things.
On Wed, Feb 01, 2023 at 01:44:31PM +0100, Borislav Petkov wrote:
> On Tue, Jan 31, 2023 at 02:54:03PM -0800, Ashok Raj wrote:
> > It's not an error, only when request_microcode() returns UCODE_ERROR, should
> > it return -EINVAL,
>
> So looking at ->request_microcode_fw(), it looks like we return
> UCODE_ERROR when something with parsing the blob has gone wrong. So I
> guess we can return something more fitting here to state that we failed
> while parsing the microcode blob from userspace: it is corrupted,
> truncated, what not.
>
> Looking at the error codes, this:
>
> #define ELIBBAD 80 /* Accessing a corrupted shared library */
>
> seems fitting as it has "corrupted" blob in the definition. EBADF sounds
> fitting too. In any case, it should be a distinct error value which
> hints at what goes wrong.
Along the same lines, when check_online_cpu() should we return -EBUSY which
would distinguish between -EINVAL vs something different?
And we have a pr_err() to indicate not all CPUs are online. I suppose this
can be dropped in the same patch to fix return code? Since the error code
should be indicative of the problem?
pr_err("Not all CPUs online, aborting microcode update.\n");
>
> > This shouldn't be noisy, but if you think this isn't needed, it can go
> > away.
>
> I think all this preemptive development - it might make sense so let's
> do it - needs to stop. If there's an *actual* real use and need for it
> sure, but let's issue a printk just because is not one of them.
>
> > When it fails due to current_rev < min_rev, Isn't it good to add indication
> > to user space that it didn't succeed? Thomas wanted these return codes, so
> > someone scripting can get a status after an attempt to load.
>
> Return codes: yes. Random, flaky, potentially overwritten in the dmesg
> ring buffer error strings - nope. Soon someone will come along and say,
> "hey, don't touch those printk formats - my tool parses them and it'll
> break if you do." Yeah, right.
>
> --
> Regards/Gruss,
> Boris.
>
> https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists