Skip to contentSkip to conversation

arm/vgic-v3: Fix write_ignore_64's check in __vgic_v3_rdistr_rd_mmio_write()

PATCH Superseded Oleksandr Tyshchenko 3 participants 5 messages May 20, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm/vgic-v3: Fix write_ignore_64's check in __vgic_v3_rdistr_rd_mmio_write()

An attempt to write access the register (i.e. GICR_PROPBASER, GICR_PENDBASER) which should be ignored (i.e. no virtual ITS present) causes the data about due to incorrect check at the write_ignore_64 label. The check should be inverted.

Fixes c4d6bbdc12e5 ("xen/arm: vgic-v3: Support 32-bit access for 64-bit registers")
---
 xen/arch/arm/vgic-v3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/vgic-v3.c +1 -1
index 2eaa48fadb..b366b046a2 100644
@@ -649,7 +649,7 @@ bad_width:
     return 0;
 
 write_ignore_64:
-    if ( vgic_reg64_check_access(dabt) ) goto bad_width;
+    if ( !vgic_reg64_check_access(dabt) ) goto bad_width;
     return 1;
 
 write_ignore_32:
Signature · 1 line
2.34.1
#1 lore raw
Quoted 2 lines · Oleksandr Tyshchenko

An attempt to write access the register (i.e. GICR_PROPBASER, GICR_PENDBASER) which should be ignored (i.e. no virtual ITS present) causes the data about

Do you mean "data abort" here?  If not, I can't parse the sentence.

Quoted 14 lines

due to incorrect check at the write_ignore_64 label. The check should be inverted.

Fixes c4d6bbdc12e5 ("xen/arm: vgic-v3: Support 32-bit access for 64-bit registers")
---
 xen/arch/arm/vgic-v3.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/vgic-v3.c +0 -0
index 2eaa48fadb..b366b046a2 100644

xen/arch/arm/vgic-v3.c bad_width: · line 652

Quoted 5 lines
xen/arch/arm/vgic-v3.c +1 -1
@@ -649,7 +649,7 @@ bad_width:
     return 0;
 
 write_ignore_64:
-    if ( vgic_reg64_check_access(dabt) ) goto bad_width;
+    if ( !vgic_reg64_check_access(dabt) ) goto bad_width;

As you're modifying anyway, the goto should be on the next line.

~Andrew

#2 lore raw

On 20.05.25 17:24, Andrew Cooper wrote:

Hello Andrew

Quoted 5 lines · Oleksandr Tyshchenko
Quoted 2 lines

An attempt to write access the register (i.e. GICR_PROPBASER, GICR_PENDBASER) which should be ignored (i.e. no virtual ITS present) causes the data about

Do you mean "data abort" here?

yes

  If not, I can't parse the sentence.

Quoted 17 lines
Quoted 17 lines

due to incorrect check at the write_ignore_64 label. The check should be inverted.

Fixes c4d6bbdc12e5 ("xen/arm: vgic-v3: Support 32-bit access for 64-bit registers")
---
  xen/arch/arm/vgic-v3.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/arm/vgic-v3.c +0 -0
index 2eaa48fadb..b366b046a2 100644
@@ -649,7 +649,7 @@ bad_width:
      return 0;
 
Quoted 5 lines

xen/arch/arm/vgic-v3.c bad_width: · line 652

Quoted 3 lines
xen/arch/arm/vgic-v3.c +1 -1
  write_ignore_64:
-    if ( vgic_reg64_check_access(dabt) ) goto bad_width;
+    if ( !vgic_reg64_check_access(dabt) ) goto bad_width;

As you're modifying anyway, the goto should be on the next line.

ok, will move

Quoted 2 lines

~Andrew

Acked-by on v1 1/1
#3 lore raw
In reply to Oleksandr Tyshchenko

Hi Oleksandr,

Quoted 2 lines · Oleksandr Tyshchenko

An attempt to write access the register (i.e. GICR_PROPBASER, GICR_PENDBASER) which should be ignored (i.e. no virtual ITS present) causes the data about

I assume, this is a guest data abort, rather than Xen crash?

Quoted 2 lines

due to incorrect check at the write_ignore_64 label. The check should be inverted.

OOI, why would a guest try to write to GICR_PROPBASER if the ITS is not present? Was it a bug in the OS?

Quoted 3 lines
Fixes c4d6bbdc12e5 ("xen/arm: vgic-v3: Support 32-bit access for 64-bit registers")

With the commit message clarified and Andrew's comments addressed:

Cheers,

Signature · 1 line
Julien Grall
#4 lore raw
Quoted 1 line · Julien Grall

Hi Oleksandr,

Hello Julien

Quoted 8 lines · Oleksandr Tyshchenko
Quoted 4 lines

An attempt to write access the register (i.e. GICR_PROPBASER, GICR_PENDBASER)
which should be ignored (i.e. no virtual ITS present) causes the data about

I assume, this is a guest data abort, rather than Xen crash?

yes

Quoted 6 lines
Quoted 3 lines

due to incorrect check at the write_ignore_64 label. The check should be inverted.

OOI, why would a guest try to write to GICR_PROPBASER if the ITS is not present? Was it a bug in the OS?

no, it was just me experimenting with redistributor registers.

Quoted 9 lines
Quoted 5 lines
Fixes c4d6bbdc12e5 ("xen/arm: vgic-v3: Support 32-bit access for

64-bit registers")

With the commit message clarified and Andrew's comments addressed:

thanks

Quoted 3 lines

Cheers,