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

Re: [XEN v4] xen/arm: vGICv3: Emulate properly 32-bit access on GICR_PENDBASER


  • To: Julien Grall <julien@xxxxxxx>, Andre Przywara <andre.przywara@xxxxxxx>
  • From: Ayan Kumar Halder <ayankuma@xxxxxxx>
  • Date: Thu, 27 Oct 2022 20:12:16 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.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=AY3lAEWtu5RtLdURwFBuSeggbt985FW2mT1VEk8w7p8=; b=Yoqyv4VYpcb04vA3Xv+T7umzlx+Or9L1yn15HMFxQLrTn9nGv0uSJIQypBquEse7o52q0O5NB7uR1W09AZMt7nZePQ4jvb3D1zagCBj7ectzfujTXAxlBUlzPpAhV3OBsBFchEdS5WfysNme4zz0tqG3MddNRDulaTIeONvRdz+vsNSw+7D+eooUyfUe4gfNUBrFF71n2iC7K9YONGV9Ys05UFLzpgHVKbggfEIfgElvydaphPCsB6vPyNBFGI2JSnZ5R0U5uto6u4xeyme9HslJxCMWmAxxf/UUAbCw6RwfHKILkQ1htFdxj4FYOrq3otR9F8zW4TjBTL40YagmOA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dHds+dUwuccWtCj37Z1OdMZayIrOte/0kHUxMwQtwmyJOpt3N2mZHWnuVaz6sNytChAWZPX3PTNw1luaKf6QF8AYl1LOXgVaBv/3Jsuqb9++vMQ8vfJlBWwu/bnakC+duo47thNOwJy6PusWQw4aVy4K6AE5VZHegJazbIUgxtpNdzGdZcDzHuIltYue150A/ZaDIU67SpVpzBmQsF+BMydf3YPIBVIPQoIK8j+zZcoDhtHKfmcIxUT83ICRTnh5I8Ty1/1ImNuj7C8bobyzJD+aie69gpSPnphce9I6Bh+FRjTn6tYycdgwJFkwYSxF9S89bLHOF1Kx4TJ7HJVH5w==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, sstabellini@xxxxxxxxxx, stefanos@xxxxxxxxxx, Volodymyr_Babchuk@xxxxxxxx, bertrand.marquis@xxxxxxx, Henry.Wang@xxxxxxx
  • Delivery-date: Thu, 27 Oct 2022 19:12:31 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 27/10/2022 17:13, Julien Grall wrote:


On 27/10/2022 16:40, Ayan Kumar Halder wrote:

On 27/10/2022 10:44, Andre Przywara wrote:
On Wed, 26 Oct 2022 19:30:04 +0100
Ayan Kumar Halder <ayankuma@xxxxxxx> wrote:

Hi,

Hi Andre,

Hi,

Hi Julien/Andre,


I need a clarification.

I am not Andre but will answer :).

[...]

          /* Writing PENDBASER with LPIs enabled is UNPREDICTABLE. */
          if ( !(v->arch.vgic.flags & VGIC_V3_LPIS_ENABLED) )
          {
-            reg = v->arch.vgic.rdist_pendbase;
+            reg = read_atomic(&v->arch.vgic.rdist_pendbase);
              vreg_reg64_update(&reg, r, info);
              reg = sanitize_pendbaser(reg);
-            v->arch.vgic.rdist_pendbase = reg;
+ write_atomic(&v->arch.vgic.rdist_pendbase, reg);
          }
-        spin_unlock_irqrestore(&v->arch.vgic.lock, false);

Shouldn't this be "spin_unlock_irqrestore(&v->arch.vgic.lock, flags)" ?

Good catch. Yes it does. The current code will clear DAIF (even if irqsave touch only I). The I/O emulation is done with interrupts enabled usually, so now they are going to be unhandled until leave_hypervisor_to_guest().

This could be a "very" long time. Thankfully ITS is experimental, otherwise I would have considered this a potential security issue.

Can you send a separate patch for that?

Thanks for confirming. I have now sent a patch to address this.

- Ayan


Cheers,




 


Rackspace

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