[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210412121947.GC24283@zn.tnic>
Date: Mon, 12 Apr 2021 14:19:47 +0200
From: Borislav Petkov <bp@...en8.de>
To: Len Brown <lenb@...nel.org>
Cc: Andy Lutomirski <luto@...nel.org>,
David Laight <David.Laight@...lab.com>,
Dave Hansen <dave.hansen@...el.com>,
Greg KH <gregkh@...uxfoundation.org>,
"Bae, Chang Seok" <chang.seok.bae@...el.com>,
X86 ML <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
libc-alpha <libc-alpha@...rceware.org>,
Florian Weimer <fweimer@...hat.com>,
Rich Felker <dalias@...c.org>, Kyle Huey <me@...ehuey.com>,
Keno Fischer <keno@...iacomputing.com>,
Linux API <linux-api@...r.kernel.org>
Subject: Re: Candidate Linux ABI for Intel AMX and hypothetical new related
features
On Sun, Apr 11, 2021 at 03:07:29PM -0400, Len Brown wrote:
> If it is the program, how does it know that the library wants to use
> what instructions?
>
> If it is the library, then you have just changed XCR0 at run-time and
> you expose breakage of the thread library that has computed XSAVE size.
So, when old programs which cannot possibly know about the arch_prctl()
extension we're proposing here, link against that library, then that
library should not be allowed to go use "fat" states.
Unless the library can "tell" the process which links to it, that it
has dynamically enlarged the save state. If it can and the process can
handle that, then all is fine, save state gets enlarged dynamically and
it all continues merrily.
Also, in order for the library to use fat states, it needs to ask the
kernel for such support - not CPUID - because the kernel is doing the
state handling for everybody and doing all the CR4.OSXSAVE setup etc.
Which also means that the kernel can help here by telling the library:
- No, you cannot use fat states with this process because it hasn't
called arch_prctl() so it cannot handle them properly.
- Yes, this process allowes me to handle fat states for it so you can
use those states and thus those instructions when doing operations for
it.
So the kernel becomes the arbiter in all this - as it should be - and
then all should work fine.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists