Re: x86, possible bug in __memmove() alternatives patching
From: Matthias Welwarsky
Date: Sat Mar 26 2022 - 07:40:21 EST
On Samstag, 26. März 2022 05:45:24 CET Dave Hansen wrote:
> On 3/25/22 15:07, Borislav Petkov wrote:
> > I know it's is probably a very rare case and Intel recommends having fast
> > string ops enabled, hence the question: would this be considered a bug in
> > the kernel that should be fixed? A potential fix could be to clear FSRM
> > together with ERMS depending on IA32_MISC_ENABLE.
>
> I'd consider it a bug in the hypervisor, personally. ;)
Of course, no doubt about that.
> But, we do try to make the kernel work even the face of funky
> hypervisors that do things that never occur on real hardware. If a nice
> patch to fix this up showed up, I'd definitely take a look.
The question is whether a sequence like this could be relevant:
0) CPU announces feature FSRM through cpuid
1) BIOS/firmware disables fast string ops through IA32_MISC_ENABLE before
loading kernel (for whatever reason)
2) Kernel populates features from cpuid
3) Kernel clears ERMS based on IA32_MISC_ENABLE
4) "alternatives" patching destroys __memmove()
That depends on whether a cpuid instruction after step 1) would still announce
FSRM. If not, then the whole point is moot and no patch needed (unless we want
to guard against hypervisor bugs).
--
Mit freundlichen Grüßen/Best regards,
Matthias Welwarsky
Project Engineer
SYSGO GmbH
Office Mainz
Am Pfaffenstein 8 / D-55270 Klein-Winternheim / Germany
Phone: +49-6136-9948-0 / Fax: +49-6136-9948-10
E-mail: matthias.welwarsky@xxxxxxxxx
_________________________________________________________________________________
Web: https://www.sysgo.com
Blog: https://www.sysgo.com/blog
Events: https://www.sysgo.com/events
Newsletter: https://www.sysgo.com/newsletter
_________________________________________________________________________________
Handelsregister/Commercial Registry: HRB Mainz 90 HRB 48884
Geschäftsführung/Managing Directors: Etienne Butery (CEO), Kai Sablotny (COO)
USt-Id-Nr./VAT-Id-No.: DE 149062328
The protection of your personal data is important to us. Under the following
link
you can see the information in accordance with article 13 GDPR:
https://www.sysgo.com/privacy_policy