From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH 2/3] tests/x86emul: Save and restore FPU state in the emulator callbacks
Date: Fri, 9 Mar 2018 11:45:11 +0000 [thread overview]
Message-ID: <2c5fa399-6379-2cd7-71fb-5c2677cf71e4@citrix.com> (raw)
In-Reply-To: <5AA280F302000078001B032E@prv-mh.provo.novell.com>
On 09/03/18 11:41, Jan Beulich wrote:
>>>> On 06.03.18 at 21:24, <andrew.cooper3@citrix.com> wrote:
>> Currently with then native toolchain on Debian Jessie ./test_x86_emulator
>> yeilds:
>>
>> Testing AVX2 256bit single native execution...okay
>> Testing AVX2 256bit single 64-bit code sequence...[line 933] failed!
>>
>> The bug is that libc's memcpy() in read() uses %xmm8 (specifically, in
>> __memcpy_sse2_unaligned()), which corrupts %ymm8 behind the back of the AVX2
>> test code.
>>
>> Switch all hooks to use "goto out" style returns, and use
>> emul_{save,restore}_fpu_state().
> "Switch hooks to use "goto out" style returns as necessary, and ..."?
> You don't even touch all of them, and even one of those that you
> touch doesn't obtain any "goto".
>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> As an immediate workaround
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> (also for patch 4)
>
> But of course this doesn't fully deal with the problem: Structure
> assignments may still cause library functions to be invoked. Plus
> there are explicit uses of memcpy() [which look safe] and
> memset() [most or even all of which don't] in the core emulator.
> I was therefore considering to instead provide hidden visibility
> wrappers inside the binary, which would save/forward/restore.
> That would also deal with someone wanting to add some printf()
> in the middle of e.g. x86_emulate() for debugging purposes.
>
> Obviously sooner or later we'll need the same for the fuzzer hooks;
> that alternative approach would perhaps result in less code churn
> there as well (the source to provide the wrappers could likely be
> shared).
I'm afraid that I don't understand what you mean here. Are you
proposing that we wrap all libc functions, and ifso, how?
~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-03-09 11:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-06 20:24 [PATCH 0/3] tests/x86emul: Fix register corruption in the test harness Andrew Cooper
2018-03-06 20:24 ` [PATCH 1/3] tests/x86emul: Helpers to save and restore FPU state Andrew Cooper
2018-03-09 11:21 ` Jan Beulich
2018-03-09 12:37 ` Jan Beulich
2018-03-09 13:38 ` Jan Beulich
2018-03-09 13:43 ` Andrew Cooper
2018-03-06 20:24 ` [PATCH 2/3] tests/x86emul: Save and restore FPU state in the emulator callbacks Andrew Cooper
2018-03-09 11:41 ` Jan Beulich
2018-03-09 11:45 ` Andrew Cooper [this message]
2018-03-09 11:57 ` Jan Beulich
2018-03-06 20:24 ` [PATCH 3/3] tests/x86emul: Improve the utility of verbose mode Andrew Cooper
2018-03-09 11:48 ` Jan Beulich
2018-03-06 20:37 ` [PATCH 4/3] tests/x86emul: Save and restore FPU state in the middle of emulation Andrew Cooper
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=2c5fa399-6379-2cd7-71fb-5c2677cf71e4@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=xen-devel@lists.xen.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).