[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH] evtchn/fifo: Don't set PENDING bit if guest misbehaves


  • To: Andrew Cooper <amc96@xxxxxxxx>, Raphael Ning <raphning@xxxxxxxxx>
  • From: Luca Fancellu <Luca.Fancellu@xxxxxxx>
  • Date: Thu, 17 Mar 2022 14:26:49 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wTbuv1OG2z8KtCobnG44/z7NMNoBKzoTcwYpriokduw=; b=jf/eHhf1eiYQNYG4mFGPmlWMwxnZSXpay64TKpr+sQYADW1LuUEggzt1+wiSF3FHApgzE3ox7D8IoGOgpuyhLIWGQEtUUEUDZ6AsbzeMMLN/u448KSjXb6LjiYcnmpvlJXgfBOyNDJNb7dfgOMbBj2rsh6ynmgMnlSQdmGnA1N9xf+B56oIoEeMpcX4q5TRlu4kD+Bk2NZ+6Hfa+EM/bmZDJo2EKgjPMbq3NQe9hlE5HoWiJ0FI8cINTMiuXuOq4iIZCKfifGTKtOvWw4eN8jMFDjsjw4Lf1YRTg5zPOsdYOc0x7GTUjpsY+1xP34yozMM+/m0Uxv9JZVkA9sFhV8w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LSG2mB5SCbYYTfxDxsijHBUci4Es6GMha00kP4ZHv+zim/TTPBLUBej7afKLl18AmJ67t8wx5/5D79D8LQBSfvYrG8c8DR4pkZVsTRYQgpG2rsm7/HyHUqooidCQiogISwNVcLhKkeJrwPxk7oxEcFG9it8/3ZqFpOYUNPK0xsbJZQhDdb4H2Xe2fu8kwSo0SCLoiwJST4VZL5Ex1Uo0RJ/0vOVDHRuRspWOgkWmKDRa4WwVXzKMdwB1aqDkyrOEVQNdBs7B4w9JqUZj9OZrZ1OpmLDBOUJjaFOJn+eDi7ZvA9ZGxUfs0R1l2NGyloI/Sz2NUgpXRUv6RWQ0xG7sOg==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, David Vrabel <dvrabel@xxxxxxxxxxxx>
  • Delivery-date: Thu, 17 Mar 2022 14:27:06 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHYOWUxkkWcdQhaQka74jKAOHn9V6zCXPqAgAFGTQA=
  • Thread-topic: [XEN PATCH] evtchn/fifo: Don't set PENDING bit if guest misbehaves


> On 16 Mar 2022, at 18:58, Andrew Cooper <amc96@xxxxxxxx> wrote:
> 
> On 16/03/2022 18:38, Raphael Ning wrote:
>> From: Raphael Ning <raphning@xxxxxxxxxx>
>> 
>> Currently, evtchn_fifo_set_pending() will mark the event as PENDING even
>> if it fails to lock the FIFO event queue(s), or if the guest has not
>> initialized the FIFO control block for the target vCPU. A well-behaved
>> guest should never trigger either of these cases.
>> 
>> There is no good reason to set the PENDING bit (the guest should not
>> depend on this behaviour anyway) or check for pollers in such corner
>> cases, so skip that. In fact, both the comment above the for loop and
>> the commit message for
>> 
>> 41a822c39263 xen/events: rework fifo queue locking
>> 
>> suggest that the bit should be set after the FIFO queue(s) are locked.
>> 
>> Take the opportunity to rename the was_pending variable (flipping its
>> sense) and switch to the standard bool type.
>> 
>> Suggested-by: David Vrabel <dvrabel@xxxxxxxxxxxx>
>> Signed-off-by: Raphael Ning <raphning@xxxxxxxxxx>
>> ---
>> xen/common/event_fifo.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>> 
>> diff --git a/xen/common/event_fifo.c b/xen/common/event_fifo.c
>> index ed4d3beb10f3..6c74ccebebb7 100644
>> --- a/xen/common/event_fifo.c
>> +++ b/xen/common/event_fifo.c
>> @@ -165,7 +165,7 @@ static void cf_check evtchn_fifo_set_pending(
>>     unsigned int port;
>>     event_word_t *word;
>>     unsigned long flags;
>> -    bool_t was_pending;
>> +    bool_t check_pollers = false;
> 
> Considering your commit message, did you intend to change this to bool?
> 
> Can be fixed on commit.  Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> 

I’ve tested on the ARM side, I’ve started/destroyed few guests from Dom0, 
connect to the console, run
some network communications between guest and Dom0, everything works:

Tested-by: Luca Fancellu <luca.fancellu@xxxxxxx>

Cheers,
Luca

> ~Andrew
> 
> P.S. David - do you want your maintainership back?  None of this code
> has undergone any major changes since you wrote it.
> 


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.