[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200602102951.GE17423@lakka.kapsi.fi>
Date: Tue, 2 Jun 2020 13:29:51 +0300
From: Petteri Aimonen <jpa@....mail.kapsi.fi>
To: Borislav Petkov <bp@...en8.de>
Cc: Andy Lutomirski <luto@...nel.org>,
Dave Hansen <dave.hansen@...el.com>,
"H. Peter Anvin" <hpa@...or.com>, x86-ml <x86@...nel.org>,
lkml <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] arch/x86: reset MXCSR to default in kernel_fpu_begin()
Hi,
> Instead of adding that kernel module which is x86-specific
> to a generic lib/ directory, it should be in, say,
> tools/testing/selftests/x86/test_fpu_module.c or so and instead of
The kernel module is not actually x86-specific, even though it is
currently only enabled for x86. amdgpu driver already does kernel mode
floating point operations on PPC64 also, and the same module could be
used to test the same thing there.
> reading /proc/sys/debug/test_fpu, the user portion of the code would
> simply modprobe it.
To deterministically trigger the bug, the syscall has to come from the
same thread that has modified MXCSR. Going through /usr/sbin/modprobe
won't work, and manually doing the necessary syscalls for module loading
seems too complicated.
> What is also missing is the user portion doing ldmxcsr before running
> the test and the test should be causing at least one exception which
> MXCSR masks off.
The fesetround() and feenableexcept() are the portable ways to modify
MXCSR. The test module does cause Precision Exception and Denormal
Exception if those exceptions are unmasked.
--
Petteri
Powered by blists - more mailing lists