qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/1] fw-cfg patches for 2020-09-18
@ 2020-09-18 15:22 Philippe Mathieu-Daudé
  2020-09-18 15:22 ` [PULL 1/1] hw/nvram/fw_cfg: fix FWCfgDataGeneratorClass::get_data() consumption Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-18 15:22 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Laszlo Ersek, Gerd Hoffmann

The following changes since commit e883b492c221241d28aaa322c61536436090538a:

  Merge remote-tracking branch 'remotes/legoater/tags/pull-aspeed-20200918' into staging (2020-09-18 13:36:42 +0100)

are available in the Git repository at:

  https://gitlab.com/philmd/qemu.git tags/fw_cfg-20200918

for you to fetch changes up to 4318432ccd3f7fb69b7169f39dcae3d4ee04f5ea:

  hw/nvram/fw_cfg: fix FWCfgDataGeneratorClass::get_data() consumption (2020-09-18 17:18:18 +0200)

----------------------------------------------------------------
fw_cfg patches

Fixes a bug in the recently introduced fw_cfg_add_from_generator().

CI jobs results:
. https://gitlab.com/philmd/qemu/-/pipelines/191714875
. https://travis-ci.org/github/philmd/qemu/builds/728288784
. https://app.shippable.com/github/philmd/qemu/runs/869/1/console
----------------------------------------------------------------

Laszlo Ersek (1):
  hw/nvram/fw_cfg: fix FWCfgDataGeneratorClass::get_data() consumption

 hw/nvram/fw_cfg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.26.2



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

* [PULL 1/1] hw/nvram/fw_cfg: fix FWCfgDataGeneratorClass::get_data() consumption
  2020-09-18 15:22 [PULL 0/1] fw-cfg patches for 2020-09-18 Philippe Mathieu-Daudé
@ 2020-09-18 15:22 ` Philippe Mathieu-Daudé
  2020-09-18 15:27 ` [PULL 0/1] fw-cfg patches for 2020-09-18 no-reply
  2020-09-18 16:23 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-09-18 15:22 UTC (permalink / raw)
  To: qemu-devel
  Cc: Philippe Mathieu-Daudé, Daniel P. Berrangé,
	Laszlo Ersek, Gerd Hoffmann

From: Laszlo Ersek <lersek@redhat.com>

The documentation on g_byte_array_free()
<https://developer.gnome.org/glib/stable/glib-Byte-Arrays.html#g-byte-array-free>
says:

> Returns
>
> the element data if free_segment is FALSE, otherwise NULL. The element
> data should be freed using g_free().

Because we currently call g_byte_array_free() with free_segment=TRUE, we
end up passing data=NULL to fw_cfg_add_file().

On the plus side, fw_cfg_data_read() and fw_cfg_dma_transfer() both deal
with NULL data gracefully: QEMU does not crash when the guest reads such
an item, the guest just gets a properly sized, but zero-filled blob.

However, the bug breaks UEFI HTTPS boot, as the IANA_TLS_CIPHER array,
generated otherwise correctly by the "tls-cipher-suites" object, is in
effect replaced with a zero blob.

Fix the issue by passing free_segment=FALSE to g_byte_array_free():

- the caller (fw_cfg_add_from_generator()) temporarily assumes ownership
  of the generated byte array,

- then ownership of the byte array is transfered to fw_cfg, as
  fw_cfg_add_file() links (not copies) "data" into fw_cfg.

Cc: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Fixes: 3203148917d035b09f71986ac2eaa19a352d6d9d
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20200916151510.22767-1-lersek@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/nvram/fw_cfg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index f3a4728288e..0e95d057fd5 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -1056,7 +1056,7 @@ bool fw_cfg_add_from_generator(FWCfgState *s, const char *filename,
         return false;
     }
     size = array->len;
-    fw_cfg_add_file(s, filename, g_byte_array_free(array, TRUE), size);
+    fw_cfg_add_file(s, filename, g_byte_array_free(array, FALSE), size);
 
     return true;
 }
-- 
2.26.2



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

* Re: [PULL 0/1] fw-cfg patches for 2020-09-18
  2020-09-18 15:22 [PULL 0/1] fw-cfg patches for 2020-09-18 Philippe Mathieu-Daudé
  2020-09-18 15:22 ` [PULL 1/1] hw/nvram/fw_cfg: fix FWCfgDataGeneratorClass::get_data() consumption Philippe Mathieu-Daudé
@ 2020-09-18 15:27 ` no-reply
  2020-09-18 16:23 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: no-reply @ 2020-09-18 15:27 UTC (permalink / raw)
  To: philmd; +Cc: philmd, lersek, qemu-devel, kraxel

Patchew URL: https://patchew.org/QEMU/20200918152207.157589-1-philmd@redhat.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

N/A. Internal error while reading log file



The full log is available at
http://patchew.org/logs/20200918152207.157589-1-philmd@redhat.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

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

* Re: [PULL 0/1] fw-cfg patches for 2020-09-18
  2020-09-18 15:22 [PULL 0/1] fw-cfg patches for 2020-09-18 Philippe Mathieu-Daudé
  2020-09-18 15:22 ` [PULL 1/1] hw/nvram/fw_cfg: fix FWCfgDataGeneratorClass::get_data() consumption Philippe Mathieu-Daudé
  2020-09-18 15:27 ` [PULL 0/1] fw-cfg patches for 2020-09-18 no-reply
@ 2020-09-18 16:23 ` Peter Maydell
  2 siblings, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2020-09-18 16:23 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé; +Cc: Laszlo Ersek, QEMU Developers, Gerd Hoffmann

On Fri, 18 Sep 2020 at 16:31, Philippe Mathieu-Daudé <philmd@redhat.com> wrote:
>
> The following changes since commit e883b492c221241d28aaa322c61536436090538a:
>
>   Merge remote-tracking branch 'remotes/legoater/tags/pull-aspeed-20200918' into staging (2020-09-18 13:36:42 +0100)
>
> are available in the Git repository at:
>
>   https://gitlab.com/philmd/qemu.git tags/fw_cfg-20200918
>
> for you to fetch changes up to 4318432ccd3f7fb69b7169f39dcae3d4ee04f5ea:
>
>   hw/nvram/fw_cfg: fix FWCfgDataGeneratorClass::get_data() consumption (2020-09-18 17:18:18 +0200)
>
> ----------------------------------------------------------------
> fw_cfg patches
>
> Fixes a bug in the recently introduced fw_cfg_add_from_generator().
>
> CI jobs results:
> . https://gitlab.com/philmd/qemu/-/pipelines/191714875
> . https://travis-ci.org/github/philmd/qemu/builds/728288784
> . https://app.shippable.com/github/philmd/qemu/runs/869/1/console
> ----------------------------------------------------------------


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.2
for any user-visible changes.

-- PMM


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

end of thread, other threads:[~2020-09-18 16:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-18 15:22 [PULL 0/1] fw-cfg patches for 2020-09-18 Philippe Mathieu-Daudé
2020-09-18 15:22 ` [PULL 1/1] hw/nvram/fw_cfg: fix FWCfgDataGeneratorClass::get_data() consumption Philippe Mathieu-Daudé
2020-09-18 15:27 ` [PULL 0/1] fw-cfg patches for 2020-09-18 no-reply
2020-09-18 16:23 ` Peter Maydell

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).