linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@amacapital.net>
To: Shuah Khan <skhan@linuxfoundation.org>
Cc: Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@alien8.de>,
	Shuah Khan <shuah@kernel.org>,
	Petteri Aimonen <jpa@git.mail.kapsi.fi>,
	Dave Hansen <dave.hansen@intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>, x86-ml <x86@kernel.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] arch/x86: reset MXCSR to default in kernel_fpu_begin()
Date: Tue, 2 Jun 2020 12:50:42 -0700	[thread overview]
Message-ID: <C6F6F6E4-CBD8-4E72-812B-99F008ECAA4F@amacapital.net> (raw)
In-Reply-To: <8b1f0bfa-79b0-74e4-0241-8b2a94491807@linuxfoundation.org>



> On Jun 2, 2020, at 10:27 AM, Shuah Khan <skhan@linuxfoundation.org> wrote:
> 
> On 6/2/20 11:03 AM, Andy Lutomirski wrote:
>>> On Tue, Jun 2, 2020 at 3:56 AM Borislav Petkov <bp@alien8.de> wrote:
>>> 
>>> Hi,
>>> 
>>> On Tue, Jun 02, 2020 at 01:29:51PM +0300, Petteri Aimonen wrote:
>>>> 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.
>>> 
>>> Then make it generic please and put the user portion in, say,
>>> tools/testing/selftests/fpu/ and we can ask ppc people to test it too.
>>> People might wanna add more stuff to it in the future, which would be
>>> good.
>>> 
>>>> 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.
>>> 
>>> Ok, fair enough. But put that file in debugfs pls.
>> I think I agree.  While it would be delightful to have general
>> selftest tooling for kernel modules, we don't have that right now, and
>> having the test just work with an appropriately configured kernel
>> would be nice.
> 
> Let's extend it to do what we want it to do. I will happy to take
> patches. If you have some concrete ideas on what we can add, please
> do a short summary of what is missing. I will find a way to get this
> done.
> 
>> How about putting the file you frob in
>> /sys/kernel/debug/selftest_helpers/something_or_other.  The idea would
>> be that /sys/kernel/debug/selftest_helpers would be a general place
>> for kernel helpers needed to make selftests work.
> 
> Is this a workaround for the lack of selftest tooling for kernel
> modules? In which case, let's us focus on fix selftest tooling.

The goal here is to have a selftest that runs kernel code as part of its operation. That is, the selftest is, logically, starting in userspace:

setup_evil_state();
ret = call_kernel_helper();
check_some_other_stuff();
undo_evil_state();

And the call_kernel_helper() could be moderately specific to the test.

> 
> thanks,
> -- Shuah

  reply	other threads:[~2020-06-02 19:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-02 10:11 [PATCH] arch/x86: reset MXCSR to default in kernel_fpu_begin() Borislav Petkov
2020-06-02 10:29 ` Petteri Aimonen
2020-06-02 10:56   ` Borislav Petkov
2020-06-02 17:03     ` Andy Lutomirski
2020-06-02 17:27       ` Shuah Khan
2020-06-02 19:50         ` Andy Lutomirski [this message]
2020-06-02 20:25           ` Shuah Khan
2020-06-03  5:19             ` Petteri Aimonen
2020-06-11 14:38               ` Shuah Khan
2020-06-11  7:36       ` Petteri Aimonen
2020-06-11  9:18         ` Borislav Petkov
2020-06-11 14:19           ` Andy Lutomirski
2020-06-11 14:50             ` Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=C6F6F6E4-CBD8-4E72-812B-99F008ECAA4F@amacapital.net \
    --to=luto@amacapital.net \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=hpa@zytor.com \
    --cc=jpa@git.mail.kapsi.fi \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).