Skip to contentSkip to conversation

acpi-pm-tmr: allow any small-size reads

PATCH Superseded Michael Tokarev 3 participants 4 messages Jul 14, 2020

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 acpi-pm-tmr: allow any small-size reads

As found in LP#1886318, MacOS Catalina performs 2-byte reads on the acpi timer address space while the spec says it should be 4-byte. Allow any small reads.

---
 hw/acpi/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

v2: fixed bug#, use the right form of S-o-b, and allow up to 1 byte reads.

I'm applying this to debian qemu package, need the fix faster in order to release security updates for other branches.

hw/acpi/core.c +4 -1
@@ -530,7 +530,10 @@ static void acpi_pm_tmr_write(void *opaque, hwaddr addr, uint64_t val,
 static const MemoryRegionOps acpi_pm_tmr_ops = {
     .read = acpi_pm_tmr_read,
     .write = acpi_pm_tmr_write,
-    .valid.min_access_size = 4,
+    .impl.min_access_size = 4,
+     /* at least MacOS Catalina reads 2 bytes and fails if it doesn't work */
+     /* allow 1-byte reads too */
+    .valid.min_access_size = 1,
     .valid.max_access_size = 4,
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
Signature · 1 line
2.20.1
#1 lore raw
Quoted 6 lines · Michael Tokarev

As found in LP#1886318, MacOS Catalina performs 2-byte reads on the acpi timer address space while the spec says it should be 4-byte. Allow any small reads.

Do we need Simon to test this? Or did you already test with MacOSX?

Quoted 27 lines
---
 hw/acpi/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

v2: fixed bug#, use the right form of S-o-b, and allow up to 1 byte reads.

I'm applying this to debian qemu package, need the fix faster in order to release security updates for other branches.

hw/acpi/core.c +4 -1
@@ -530,7 +530,10 @@ static void acpi_pm_tmr_write(void *opaque, hwaddr addr, uint64_t val,
 static const MemoryRegionOps acpi_pm_tmr_ops = {
     .read = acpi_pm_tmr_read,
     .write = acpi_pm_tmr_write,
-    .valid.min_access_size = 4,
+    .impl.min_access_size = 4,
+     /* at least MacOS Catalina reads 2 bytes and fails if it doesn't work */
+     /* allow 1-byte reads too */
+    .valid.min_access_size = 1,
     .valid.max_access_size = 4,
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
Signature · 1 line
2.20.1
#2 lore raw
In reply to Michael Tokarev
Quoted 4 lines · Michael Tokarev

As found in LP#1886318, MacOS Catalina performs 2-byte reads on the acpi timer address space while the spec says it should be 4-byte. Allow any small reads.

Quoted 16 lines
---
 hw/acpi/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

v2: fixed bug#, use the right form of S-o-b, and allow up to 1 byte reads.

I'm applying this to debian qemu package, need the fix faster in order to release security updates for other branches.

hw/acpi/core.c static void acpi_pm_tmr_write(void *opaque, hwaddr addr, uint64_t val, · line 533

Quoted 4 lines
hw/acpi/core.c +1 -0
@@ -530,7 +530,10 @@ static void acpi_pm_tmr_write(void *opaque, hwaddr addr, uint64_t val,
 static const MemoryRegionOps acpi_pm_tmr_ops = {
     .read = acpi_pm_tmr_read,
     .write = acpi_pm_tmr_write,
+    .impl.min_access_size = 4,

This is correct.

hw/acpi/core.c static void acpi_pm_tmr_write(void *opaque, hwaddr addr, uint64_t val, · line 536

Quoted 4 lines
hw/acpi/core.c +3 -1
+     /* at least MacOS Catalina reads 2 bytes and fails if it doesn't work */
+     /* allow 1-byte reads too */
-    .valid.min_access_size = 4,
+    .valid.min_access_size = 1,

This is a quick fix for 5.1, but I don't think this is the correct long-term fix. See:
https://lists.gnu.org/archive/html/qemu-devel/2020-07/msg04639.html

Quoted 4 lines
hw/acpi/core.c +0 -0
     .valid.max_access_size = 4,
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
#3 lore raw
In reply to Michael Tokarev
Quoted 6 lines · Michael Tokarev

As found in LP#1886318, MacOS Catalina performs 2-byte reads on the acpi timer address space while the spec says it should be 4-byte. Allow any small reads.

Simon's explanation about the history is good to have here, and I guess Fixes tags (both what you found and what Simon found) can't hurt either. I would CC stable too.

Simon do you have the time to iterate on this patch or would you rather have Michael do it?

Quoted 14 lines
---
 hw/acpi/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

v2: fixed bug#, use the right form of S-o-b, and allow up to 1 byte reads.

I'm applying this to debian qemu package, need the fix faster in order to release security updates for other branches.

hw/acpi/core.c static void acpi_pm_tmr_write(void *opaque, hwaddr addr, uint64_t val, · line 535

Quoted 7 lines
hw/acpi/core.c +3 -1
@@ -530,7 +530,10 @@ static void acpi_pm_tmr_write(void *opaque, hwaddr addr, uint64_t val,
 static const MemoryRegionOps acpi_pm_tmr_ops = {
     .read = acpi_pm_tmr_read,
     .write = acpi_pm_tmr_write,
-    .valid.min_access_size = 4,
+    .impl.min_access_size = 4,
+     /* at least MacOS Catalina reads 2 bytes and fails if it doesn't work */
+     /* allow 1-byte reads too */

... since historically we did in the past.

Quoted 6 lines
hw/acpi/core.c +1 -0
+    .valid.min_access_size = 1,
     .valid.max_access_size = 4,
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
Signature · 1 line
2.20.1