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: <7bbef366-c897-4cd2-ae69-d3e8019c5b3a@p183>
Date:   Wed, 6 Dec 2023 09:15:39 +0300
From:   Alexey Dobriyan <adobriyan@...il.com>
To:     Dave Hansen <dave.hansen@...el.com>
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
        linux-kernel@...r.kernel.org, "H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH] x86_64: test xmm/ymm register state after execve(2)

On Tue, Dec 05, 2023 at 12:39:32PM -0800, Dave Hansen wrote:
> On 12/5/23 06:21, Alexey Dobriyan wrote:
> > Test that xmm/ymm registers are cleared immediately after execve(2).
> > 
> > It is opportunistically named "check_xmm_ymm_zmm" because I don't have
> > AVX-512 machine but it will be trivial to extend without renaming stuff.
> 
> Hi Alexey,
> 
> This looks pretty useful.  I know we've had bugs in this area in the
> past.  Was there any recent motivation for this, though?  Just curious.

I found check_initial_reg_state.c with cool assembly but only general
registers being checked.

> > --- /dev/null
> > +++ b/tools/testing/selftests/x86/check_xmm_ymm_zmm.c
> > @@ -0,0 +1,176 @@
> > +/*
> > + * Copyright (c) 2023 Alexey Dobriyan <adobriyan@...il.com>
> > + *
> > + * Permission to use, copy, modify, and distribute this software for any
> > + * purpose with or without fee is hereby granted, provided that the above
> > + * copyright notice and this permission notice appear in all copies.
> > + *
> > + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
> > + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
> > + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
> > + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
> > + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
> > + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
> > + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
> > + */
> > +/* Test that xmm, ymm registers are cleared immediately after execve(2). */
> 
> Can this be trimmed down to a nice SPDX header?

I'd rather not.

This is standalone test program, not part of kernel proper, so if it's
copied somewhere than copyrights are retained. Another project might not
even use SPDX scheme.

> > +#include <stdio.h>
> > +#include <string.h>
> > +
> > +#if   defined __amd64__
> > +#elif defined __i386__
> > +#error "fix register count, SSE2 detection"
> > +#else
> > +#error
> > +#endif

> > +".Ltest_xmm:"
> > +	"movdqu %xmm0, xmm + 16 * 0;"
> > +	"movdqu %xmm1, xmm + 16 * 1;"
> 
> Does this work on systems without XMMs?  I know it's not common these
> days but it's possible, especially in VMs.

No. But I think all x86_64 systems have SSE2. So it is up to whoever will
port this test to i386.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ