Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1373682

Re: [PATCH] kvm: x86: do not leak guest xcr0 into host interrupt handlers

From Paolo Bonzini <pbonzini@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH] kvm: x86: do not leak guest xcr0 into host interrupt handlers
Date 2016-04-07 21:10 +0200
Message-ID <rlntw-7U-17@gated-at.bofh.it> (permalink)
References <ritYu-1Cy-5@gated-at.bofh.it> <rkxlh-2sv-55@gated-at.bofh.it> <rkByy-6bC-13@gated-at.bofh.it> <rle6T-1ww-33@gated-at.bofh.it> <rlmH8-7YH-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



----- Original Message -----
> >>> While running my acceptance tests, in one case I got one CPU whose xcr0
> >>> had leaked into the host.  This showed up as a SIGILL in strncasecmp's
> >>> AVX code, and a simple program confirmed it:
> >>>
> >>>     $ cat xgetbv.c
> >>>     #include <stdio.h>
> >>>     int main(void)
> >>>     {
> >>>         unsigned xcr0_h, xcr0_l;
> >>>         asm("xgetbv" : "=d"(xcr0_h), "=a"(xcr0_l) : "c"(0));
> >>>         printf("%08x:%08x\n", xcr0_h, xcr0_l);
> >>>     }
> >>>     $ gcc xgetbv.c -O2
> >>>     $ for i in `seq 0 55`; do echo $i `taskset -c $i ./a.out`; done|grep
> >>>     -v 007
> >>>     19 00000000:00000003
> >>>
> >>> I'm going to rerun the tests without this patch, as it seems the most
> >>> likely culprit, and leave it out of the pull request if they pass.
> >>
> >> Agreed this is a very likely culprit. I think I see one way the
> >> guest's xcr0 can leak into the host.
> >
> > That's cancel_injection, right?  If it's just about moving the load call
> > below, I can do that.  Hmm, I will even test that today. :)
> 
> Yes that's what I was thinking, move kvm_load_guest_xcr0 below that if.
> 
> Thank you :). Let me know how testing goes.

It went well.

Paolo

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] kvm: x86: do not leak guest xcr0 into host interrupt  handlers Paolo Bonzini <pbonzini@redhat.com> - 2016-04-05 13:30 +0200
  Re: [PATCH] kvm: x86: do not leak guest xcr0 into host interrupt handlers David Matlack <dmatlack@google.com> - 2016-04-05 18:00 +0200
    Re: [PATCH] kvm: x86: do not leak guest xcr0 into host interrupt  handlers Paolo Bonzini <pbonzini@redhat.com> - 2016-04-05 18:10 +0200
    Re: [PATCH] kvm: x86: do not leak guest xcr0 into host interrupt  handlers Paolo Bonzini <pbonzini@redhat.com> - 2016-04-07 11:10 +0200
      Re: [PATCH] kvm: x86: do not leak guest xcr0 into host interrupt handlers David Matlack <dmatlack@google.com> - 2016-04-07 20:20 +0200
        Re: [PATCH] kvm: x86: do not leak guest xcr0 into host interrupt  handlers Paolo Bonzini <pbonzini@redhat.com> - 2016-04-07 21:10 +0200
          Re: [PATCH] kvm: x86: do not leak guest xcr0 into host interrupt handlers David Matlack <dmatlack@google.com> - 2016-04-08 18:30 +0200
            Re: [PATCH] kvm: x86: do not leak guest xcr0 into host interrupt handlers David Matlack <dmatlack@google.com> - 2016-04-08 19:00 +0200
            Re: [PATCH] kvm: x86: do not leak guest xcr0 into host interrupt  handlers Paolo Bonzini <pbonzini@redhat.com> - 2016-04-08 19:00 +0200

csiph-web