lkml.org 
[lkml]   [2010]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/2] KVM, Fix QEMU-KVM is killed by guest SRAO MCE
From
Date
On Tue, 2010-04-27 at 17:30 +0800, Avi Kivity wrote:
> On 04/27/2010 12:25 PM, Huang Ying wrote:
> >
> >
> >> On 04/27/2010 10:04 AM, Huang Ying wrote:
> >>
> >>> +static void kvm_send_hwpoison_signal(struct kvm *kvm, gfn_t gfn)
> >>> +{
> >>> + char buf[1];
> >>> + void __user *hva;
> >>> + int r;
> >>> +
> >>> + /* Touch the page, so send SIGBUS */
> >>> + hva = (void __user *)gfn_to_hva(kvm, gfn);
> >>> + r = copy_from_user(buf, hva, 1);
> >>>
> >>>
> >> No error check? What will a copy_from_user() of poisoned page expected
> >> to return?
> >>
> >> Best to return -EFAULT on failure for consistency.
> >>
> > Just want to use the side effect of copy_from_user, SIGBUS will be sent
> > to current process because the page touched is marked as poisoned. That
> > is, failure is expected, so the return value is not checked.
> >
>
> What if the failure doesn't happen? Say, someone mmap()ed over the page.

Sorry, not get your idea clearly. hva is re-mmap()ed? We just read the
hva, not write, so I think it should be OK here.

> btw, better to use (void)copy_from_user(...) instead to avoid the
> initialized but not used warning the compiler may generate.

OK. Will do that.

Best Regards,
Huang Ying




\
 
 \ /
  Last update: 2010-04-28 04:59    [W:1.715 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site