From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: George Dunlap <dunlapg@umich.edu>, Chris Brannon <cmb@prgmr.com>
Cc: Juergen Gross <jgross@suse.com>,
xen-devel <xen-devel@lists.xenproject.org>,
Andy Lutomirski <luto@kernel.org>
Subject: Re: backport of XSA-274 patch to 4.9.x kernel (could use a review)
Date: Tue, 7 Aug 2018 14:49:02 -0400 [thread overview]
Message-ID: <a88677f5-19fd-f580-c05a-b53e43c9008f@oracle.com> (raw)
In-Reply-To: <CAFLBxZb4XK+MvL-MR5WbeRWVJ=5juUSJ8hg6qwowdHAPAr+hMA@mail.gmail.com>
On 08/07/2018 01:20 PM, George Dunlap wrote:
> On Mon, Aug 6, 2018 at 8:10 PM, Chris Brannon <cmb@prgmr.com> wrote:
>> I just got the following patch from a colleague. It's a backport of
>> the XSA 274 kernel patch to 4.9.x kernels. The kernel patch given in
>> the XSA would not apply cleanly. Would someone mind reviewing it? It
>> would be much appreciated.
>>
>> commit b3681dd548d06deb2e1573890829dff4b15abf46 upstream.
>>
>> This version applies to v4.9.
>>
>> error_entry and error_exit communicate the user vs kernel status of
>> the frame using %ebx. This is unnecessary -- the information is in
>> regs->cs. Just use regs->cs.
>>
>> This makes error_entry simpler and makes error_exit more robust.
>>
>> It also fixes a nasty bug. Before all the Spectre nonsense, The
>> xen_failsafe_callback entry point returned like this:
>>
>> ALLOC_PT_GPREGS_ON_STACK
>> SAVE_C_REGS
>> SAVE_EXTRA_REGS
>> ENCODE_FRAME_POINTER
>> jmp error_exit
>>
>> And it did not go through error_entry. This was bogus: RBX
>> contained garbage, and error_exit expected a flag in RBX.
>> Fortunately, it generally contained *nonzero* garbage, so the
>> correct code path was used. As part of the Spectre fixes, code was
>> added to clear RBX to mitigate certain speculation attacks. Now,
>> depending on kernel configuration, RBX got zeroed and, when running
>> some Wine workloads, the kernel crashes. This was introduced by:
>>
>> commit 3ac6d8c787b8 ("x86/entry/64: Clear registers for
>> exceptions/interrupts, to reduce speculation attack surface")
>>
>> With this patch applied, RBX is no longer needed as a flag, and the
>> problem goes away.
>>
>> Cc: Brian Gerst <brgerst@gmail.com>
>> Cc: Borislav Petkov <bp@alien8.de>
>> Cc: Dominik Brodowski <linux@dominikbrodowski.net>
>> Cc: Ingo Molnar <mingo@redhat.com>
>> Cc: "H. Peter Anvin" <hpa@zytor.com>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
>> Cc: Juergen Gross <jgross@suse.com>
>> Cc: xen-devel@lists.xenproject.org
>> Cc: x86@kernel.org
>> Cc: stable@vger.kernel.org
>> Cc: Andy Lutomirski <luto@kernel.org>
>> Fixes: 3ac6d8c787b8 ("x86/entry/64: Clear registers for exceptions/interrupts, to reduce speculation attack surface")
>> Reported-and-tested-by: "M. Vefa Bicakci" <m.v.b@runbox.com>
>> Signed-off-by: Sarah Newman <srn@prgmr.com>
> I think you need to retain Andy's SoB, and add your own underneath.
>
> This looks plausible to me -- Andy / Boris, any opinions?
LGTM.
Note also that Andy's patch had slightly longer commit message
(including some of the tags that you are missing), with this suggestion:
[ Note to stable maintainers: this should probably get applied to all
kernels. If you're nervous about that, a more conservative fix to
add xorl %ebx,%ebx; incl %ebx before the jump to error_exit should
also fix the problem. ]
-boris
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-08-07 18:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-06 19:10 backport of XSA-274 patch to 4.9.x kernel (could use a review) Chris Brannon
2018-08-07 17:20 ` George Dunlap
2018-08-07 18:49 ` Boris Ostrovsky [this message]
2018-08-07 22:57 ` Andy Lutomirski
2018-08-08 17:35 ` [PATCH] x86/entry/64: Remove %ebx handling from error_entry/exit Sarah Newman
2018-08-09 12:41 ` David Woodhouse
[not found] ` <1533818501.5775.4.camel@infradead.org>
2018-08-10 7:23 ` Sarah Newman
[not found] ` <1f15d219-46fd-fc21-84d5-877a7af4c87e@prgmr.com>
2018-08-16 15:19 ` Greg KH
[not found] ` <20180816151946.GH10648@kroah.com>
2018-08-16 15:35 ` Andy Lutomirski
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=a88677f5-19fd-f580-c05a-b53e43c9008f@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=cmb@prgmr.com \
--cc=dunlapg@umich.edu \
--cc=jgross@suse.com \
--cc=luto@kernel.org \
--cc=xen-devel@lists.xenproject.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).