Re: [Patch v3 Part2 1/9] x86/microcode: Taint kernel only if microcode loading was successful

From: Borislav Petkov
Date: Tue Jan 31 2023 - 15:20:51 EST


On Tue, Jan 31, 2023 at 08:51:25AM -0800, Ashok Raj wrote:
> remove ret = 0 during initialization since its cleared right below. (tglx)

Sure.

> Need to set ret explicitly to either -EINVAL, or size. Otherwise it will be
> endlessly waiting for write to complete. (As Aubrey pointed out)

Then do:

tmp_ret = microcode_ops->request_microcode_fw(bsp, &microcode_pdev->dev);
if (tmp_ret != UCODE_NEW)
return size;

to signal what it is. It certainly ain't an error if it doesn't find new
microcode.

> I think its safe to leave ret as is, since microcode_reload_late() only
> returns -1, or 0.

No it doesn't. Hint: stop_machine_cpuslocked().

> Pull this into the ret == 0, so taint only if the update was successful?

Ok.

> And add a message so its not silent?

You'd add a printk for every possible operation, wouldn't you?

See, the world doesn't revolve around microcode loading. If that thing
fails, then someone has done a bad job at the CPU vendor testing,
provided the code does the right thing.

--
Regards/Gruss,
Boris.

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