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: <YbRa/hyZIkQ4h3YL@xpf.sh.intel.com>
Date:   Sat, 11 Dec 2021 16:02:06 +0800
From:   Pengfei Xu <pengfei.xu@...el.com>
To:     Dave Hansen <dave.hansen@...el.com>
Cc:     Shuah Khan <skhan@...uxfoundation.org>,
        linux-kselftest <linux-kselftest@...r.kernel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        Heng Su <heng.su@...el.com>, Luck Tony <tony.luck@...el.com>,
        Mehta Sohil <sohil.mehta@...el.com>,
        Chen Yu C <yu.c.chen@...el.com>,
        Andy Lutomirski <luto@...nel.org>
Subject: Re: [RFC PATCH v5 1/2] selftests/x86: add xsave test during and
 after signal handling

Hi Dave,

On 2021-12-10 at 08:48:08 -0800, Dave Hansen wrote:
> On 12/9/21 8:47 PM, Pengfei Xu wrote:
> > How about the following changes:
> > Will remove set_avx2_ymm() and will only check XSAVE_MASK_FP, XSAVE_MASK_OPMASK
> > and XSAVE_MASK_PKRU xstates after signal handling and process switch,
> 
> First and foremost, the whole point of these tests is to ensure that the
> kernel is properly maintaining register state.  Removing registers from
> the test moves *away* from the primary goal of this test.
> 
 Thanks for suggestion!
 Actually, I already removed any useless libc function before and after
 xsave action, only left the test action between xsave action:
"
	XSAVE(xsave_buf2, XSAVE_TEST_MASK);
	do raise signal or fork test
	XSAVE(xsave_buf3, XSAVE_TEST_MASK);
"
  I found that after fork() function in virtual machine, XMM0 or XMM1 register
will be used and changed.
  But in YMM xstate, I haven't see signal handline and fork action will use
and change YMM regiseters in the test. Seems we could keep YMM xstate test.
  Seems it needs some other better way for XMM xstate.

> Second, you just listed three states there.  Have you considered looking
> at whether those have the same problem as the XMM/YMM registers?  Please do.
> 
  I have tested FP, AVX512 opmask and pkru xstates on different platforms and
virtual machine, gdb these 3 xstates with fork and signal handling even printf,
above 3 functions will not use and change above 3 xstates. I used previous
xsave instruction tests to get the results.

> Third (and I've also suggested this before), we should explicitly tell
> the compiler not to use the FPU registers.  This is what the kernel
> does, and it's what allows us to, for instance, make function calls in
> the kernel without clobbering userspace content in XSAVE-managed registers.
> 
> If we did that, then we would only have to worry about calls to things
> *outside* of the test program, like libc.
  Thanks! Yes, I will add "float a = 0.12, b = 0.34; a = a + b;" to tell
libc process, float points has been used.
  Seems if there is no addition, subtraction, multiplication or division,
there is no change in FP xstate compared with no float definition. If there
is above operation, mxcsr(xstate offset 0x18-0x1b bytes)will change from 801f
to a01f. Rounding control bit change from 00 to 01.

Thanks!
BR.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ