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: <CALCETrWG7E2LCSyvaay05R4Sa3mU_t5C5W4rYGuA3+dzaBF9tQ@mail.gmail.com>
Date:   Fri, 7 May 2021 11:50:20 -0700
From:   Andy Lutomirski <luto@...nel.org>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     Dave Hansen <dave.hansen@...el.com>,
        Florian Weimer <fweimer@...hat.com>,
        Len Brown <lenb@...nel.org>, Borislav Petkov <bp@...en8.de>,
        Willy Tarreau <w@....eu>, Andy Lutomirski <luto@...nel.org>,
        "Bae, Chang Seok" <chang.seok.bae@...el.com>,
        X86 ML <x86@...nel.org>, LKML <linux-kernel@...r.kernel.org>,
        linux-abi@...r.kernel.org,
        "libc-alpha@...rceware.org" <libc-alpha@...rceware.org>,
        Rich Felker <dalias@...c.org>, Kyle Huey <me@...ehuey.com>,
        Keno Fischer <keno@...iacomputing.com>
Subject: Re: Candidate Linux ABI for Intel AMX and hypothetical new related features

On Fri, May 7, 2021 at 11:44 AM Thomas Gleixner <tglx@...utronix.de> wrote:
>
> On Mon, May 03 2021 at 06:43, Dave Hansen wrote:
> > On 5/2/21 10:18 PM, Florian Weimer wrote:
> >>> 5. If the feature is enabled in XCR0, the user happily uses it.
> >>>
> >>>     For AMX, Linux implements "transparent first use"
> >>>     so that it doesn't have to allocate 8KB context switch
> >>>     buffers for tasks that don't actually use AMX.
> >>>     It does this by arming XFD for all tasks, and taking a #NM
> >>>     to allocate a context switch buffer only for those tasks
> >>>     that actually execute AMX instructions.
> >> What happens if the kernel cannot allocate that additional context
> >> switch buffer?
> >
> > Well, it's vmalloc()'d and currently smaller that the kernel stack,
> > which is also vmalloc()'d.  While it can theoretically fail, if it
> > happens you have bigger problems on your hands.
>
> Such a buffer allocation might also exceed a per process/cgroup
> limitation. Anything else which is accounted happens in syscall context
> which then returns an error on which the application can react.
>
> So what's the consequence when the allocation fails? Kill it right away
> from #NM? Kill it on the first signal? Do nothing and see what happens?
>

It has to be an immediate signal or kill.  A failure to load FPU state
is somewhat tolerable (and has to be for CET), but a failure to *save*
FPU state on a context switch would be a really nasty can of worms.
At the very least we will want arch_prctl(ARCH_ALLOCTE_XSTATE, mask)
to allow HPC workloads to manually allocate the state and get an error
code if it fails.

--Andy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ