From: Borislav Petkov <bp@suse.de>
To: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Andy Lutomirski <luto@kernel.org>, Ingo Molnar <mingo@kernel.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH urgent] x86, asm: Disable opportunistic SYSRET if regs->flags has TF set
Date: Thu, 2 Apr 2015 08:16:53 +0200 [thread overview]
Message-ID: <20150402061653.GA4579@pd.tnic> (raw)
In-Reply-To: <551C6098.9030705@redhat.com>
On Wed, Apr 01, 2015 at 11:18:16PM +0200, Denys Vlasenko wrote:
> On 04/01/2015 09:25 PM, Andy Lutomirski wrote:
> > Fix it by using IRET to restore TF. Since it's late, I'm keeping
> > this minimal and keeping "testq" instead of switching to "testl".
>
> Changing to "testl" here wins nothing.
Except less data (a dword) being shuffled and tracked for dependencies
in the machine instead of qword.
> Since r11 is used, REX prefix will be encoded anyway.
As a future cleanup, one could use one of the "old", i.e. not-extended
registers to save 2 bytes per insn (REX pfx and ModRM) but one has to
remember to do
mov %rax, %r11
in the end.
And yep, it should preferrably be %rax as we have opcode 0xa9 which
tests an immediate and RAX and saves us the ModRM as we don't need to
specify a register.
orig:
a42: 49 f7 c3 00 00 01 00 test $0x10000,%r11
a49: 75 41 jne a8c <opportunistic_sysret_failed>
Andy:
a42: 49 f7 c3 00 01 01 00 test $0x10100,%r11
a49: 75 41 jne a8c <opportunistic_sysret_failed>
testl:
a42: 41 f7 c3 00 01 01 00 test $0x10100,%r11d
a49: 75 41 jne a8c <opportunistic_sysret_failed>
%rax:
a42: a9 00 01 01 00 test $0x10100,%eax
a47: 75 41 jne a8a <opportunistic_sysret_failed>
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
prev parent reply other threads:[~2015-04-02 6:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-01 19:25 [PATCH urgent] x86, asm: Disable opportunistic SYSRET if regs->flags has TF set Andy Lutomirski
2015-04-01 21:18 ` Denys Vlasenko
2015-04-02 6:16 ` Borislav Petkov [this message]
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=20150402061653.GA4579@pd.tnic \
--to=bp@suse.de \
--cc=dvlasenk@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.