qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 for-5.1] acpi-pm-tmr: allow any small-size reads
@ 2020-07-14 10:51 Michael Tokarev
  2020-07-14 11:05 ` Michael S. Tsirkin
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Michael Tokarev @ 2020-07-14 10:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: Simon John, Michael Tokarev, Michael S . Tsirkin

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.

Reported-By: Simon John <git@the-jedi.co.uk>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
 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.

diff --git a/hw/acpi/core.c b/hw/acpi/core.c
--- a/hw/acpi/core.c
+++ b/hw/acpi/core.c
@@ -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,
 };
-- 
2.20.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 for-5.1] acpi-pm-tmr: allow any small-size reads
  2020-07-14 10:51 [PATCH v2 for-5.1] acpi-pm-tmr: allow any small-size reads Michael Tokarev
@ 2020-07-14 11:05 ` Michael S. Tsirkin
  2020-07-14 11:08 ` Philippe Mathieu-Daudé
  2020-07-14 11:10 ` Michael S. Tsirkin
  2 siblings, 0 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2020-07-14 11:05 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: Simon John, qemu-devel

On Tue, Jul 14, 2020 at 01:51:13PM +0300, Michael Tokarev wrote:
> 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.
> 
> Reported-By: Simon John <git@the-jedi.co.uk>
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>


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



> ---
>  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.
> 
> diff --git a/hw/acpi/core.c b/hw/acpi/core.c
> --- a/hw/acpi/core.c
> +++ b/hw/acpi/core.c
> @@ -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,
>  };
> -- 
> 2.20.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 for-5.1] acpi-pm-tmr: allow any small-size reads
  2020-07-14 10:51 [PATCH v2 for-5.1] acpi-pm-tmr: allow any small-size reads Michael Tokarev
  2020-07-14 11:05 ` Michael S. Tsirkin
@ 2020-07-14 11:08 ` Philippe Mathieu-Daudé
  2020-07-14 11:10 ` Michael S. Tsirkin
  2 siblings, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-07-14 11:08 UTC (permalink / raw)
  To: Michael Tokarev, qemu-devel; +Cc: Simon John, Michael S . Tsirkin

On 7/14/20 12:51 PM, Michael Tokarev wrote:
> 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.
> 

BugLink: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=964247

> Reported-By: Simon John <git@the-jedi.co.uk>
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> ---
>  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.
> 
> diff --git a/hw/acpi/core.c b/hw/acpi/core.c
> --- a/hw/acpi/core.c
> +++ b/hw/acpi/core.c
> @@ -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.

> +     /* 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

>      .valid.max_access_size = 4,
>      .endianness = DEVICE_LITTLE_ENDIAN,
>  };
> 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 for-5.1] acpi-pm-tmr: allow any small-size reads
  2020-07-14 10:51 [PATCH v2 for-5.1] acpi-pm-tmr: allow any small-size reads Michael Tokarev
  2020-07-14 11:05 ` Michael S. Tsirkin
  2020-07-14 11:08 ` Philippe Mathieu-Daudé
@ 2020-07-14 11:10 ` Michael S. Tsirkin
  2 siblings, 0 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2020-07-14 11:10 UTC (permalink / raw)
  To: Michael Tokarev; +Cc: Simon John, qemu-devel

On Tue, Jul 14, 2020 at 01:51:13PM +0300, Michael Tokarev wrote:
> 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.
> 
> Reported-By: Simon John <git@the-jedi.co.uk>
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>

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?


> ---
>  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.
> 
> diff --git a/hw/acpi/core.c b/hw/acpi/core.c
> --- a/hw/acpi/core.c
> +++ b/hw/acpi/core.c
> @@ -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.

> +    .valid.min_access_size = 1,
>      .valid.max_access_size = 4,
>      .endianness = DEVICE_LITTLE_ENDIAN,
>  };
> -- 
> 2.20.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 for-5.1] acpi-pm-tmr: allow any small-size reads
@ 2020-07-14 12:51 Simon John
  2020-07-14 13:14 ` Michael S. Tsirkin
  0 siblings, 1 reply; 6+ messages in thread
From: Simon John @ 2020-07-14 12:51 UTC (permalink / raw)
  To: qemu-devel; +Cc: mst

On Tue, 14 Jul 2020 07:10:14 -0400, Michael S. Tsirkin wrote:
> On Tue, Jul 14, 2020 at 01:51:13PM +0300, Michael Tokarev wrote:
>> 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.
>> 
>> Reported-By: Simon John <git@the-jedi.co.uk>
>> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> 
> 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?

Sorry, I seem to not be getting all of these emails but trying to watch 
the list archive.

I just tested Michael's v2 patch and it works fine:

static const MemoryRegionOps acpi_pm_tmr_ops = {
     .read = acpi_pm_tmr_read,
     .write = acpi_pm_tmr_write,
     .impl.min_access_size = 4,
     .valid.min_access_size = 1,
     .valid.max_access_size = 4,
     .endianness = DEVICE_LITTLE_ENDIAN,
};

I'm happy for Michael to proceed with the patch, he's mentioned me and 
linked to the launchpad bug where the history is.

Regards.

-- 
Simon John


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 for-5.1] acpi-pm-tmr: allow any small-size reads
  2020-07-14 12:51 Simon John
@ 2020-07-14 13:14 ` Michael S. Tsirkin
  0 siblings, 0 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2020-07-14 13:14 UTC (permalink / raw)
  To: Simon John; +Cc: qemu-devel

On Tue, Jul 14, 2020 at 01:51:45PM +0100, Simon John wrote:
> On Tue, 14 Jul 2020 07:10:14 -0400, Michael S. Tsirkin wrote:
> > On Tue, Jul 14, 2020 at 01:51:13PM +0300, Michael Tokarev wrote:
> > > 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.
> > > 
> > > Reported-By: Simon John <git@the-jedi.co.uk>
> > > Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> > 
> > 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?
> 
> Sorry, I seem to not be getting all of these emails but trying to watch the
> list archive.
> 
> I just tested Michael's v2 patch and it works fine:
> 
> static const MemoryRegionOps acpi_pm_tmr_ops = {
>     .read = acpi_pm_tmr_read,
>     .write = acpi_pm_tmr_write,
>     .impl.min_access_size = 4,
>     .valid.min_access_size = 1,
>     .valid.max_access_size = 4,
>     .endianness = DEVICE_LITTLE_ENDIAN,
> };
> 
> I'm happy for Michael to proceed with the patch, he's mentioned me and
> linked to the launchpad bug where the history is.
> 
> Regards.
> 
> -- 
> Simon John

Great, thanks!
Michael so I think the patch is fine, just some nitpicking
about commit log and comments. If you can address and repost,
that would be awesome!

-- 
MST



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-07-14 13:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-14 10:51 [PATCH v2 for-5.1] acpi-pm-tmr: allow any small-size reads Michael Tokarev
2020-07-14 11:05 ` Michael S. Tsirkin
2020-07-14 11:08 ` Philippe Mathieu-Daudé
2020-07-14 11:10 ` Michael S. Tsirkin
  -- strict thread matches above, loose matches on Subject: below --
2020-07-14 12:51 Simon John
2020-07-14 13:14 ` Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).