From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wifxm-0000NR-K7 for qemu-devel@nongnu.org; Fri, 09 May 2014 04:15:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wifxg-0000LH-Fr for qemu-devel@nongnu.org; Fri, 09 May 2014 04:15:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11870) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wifxg-0000L9-81 for qemu-devel@nongnu.org; Fri, 09 May 2014 04:15:20 -0400 Message-ID: <536C8E83.8030504@redhat.com> Date: Fri, 09 May 2014 10:14:59 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <33183CC9F5247A488A2544077AF19020815E7324@SZXEMA503-MBS.china.huawei.com> In-Reply-To: <33183CC9F5247A488A2544077AF19020815E7324@SZXEMA503-MBS.china.huawei.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [RFC] vhost: Can we change synchronize_rcu to call_rcu in vhost_set_memory() in vhost kernel module? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Gonglei (Arei)" , "qemu-devel@nongnu.org" Cc: "Huangweidong (C)" , "Herongguang (Stephen)" , "mst@redhat.com" Il 09/05/2014 03:57, Gonglei (Arei) ha scritto: > Hi, > > Vhost devices need to do VHOST_SET_MEM_TABLE ioctl in vhost_dev_start() > to tell vhost kernel modules GPA to HVA memory mappings, which consume is expensively. > The reason is same as KVM_SET_GSI_ROUTING ioctl. That is, in ioctl processing, > kmod and vhost calls synchronize_rcu() to wait for grace period to free old memory. > > In KVM_SET_GSI_ROUTING case, we cannot simply change synchronize_rcu to call_rcu, > since this may leads to DOS attacks if guest VM keeps setting IRQ affinity. > > In VHOST_SET_MEM_TABLE case, I wonder if we can change synchronize_rcu() to call_rcu(), > i.e., is it possible to trigger DOS attack in guest? There are some cases QEMU would do > VHOST_SET_MEM_TABLE ioctl, like VM start/reboot/attach vhost devices, and RAM memory > regions in system memory address space change. > > And I'd like to know if guest activities could lead to RAM memory regions change? Yes, for example enabling/disabling PCI BARs would have that effect. Paolo