Skip to content

Commit

Permalink
fw_cfg: Don't set callback_opaque NULL in fw_cfg_modify_bytes_read()
Browse files Browse the repository at this point in the history
On arm/virt platform, Chen Xiang reported a Guest crash while
attempting the below steps,

1. Launch the Guest with nvdimm=on
2. Hot-add a NVDIMM dev
3. Reboot
4. Guest boots fine.
5. Reboot again.
6. Guest boot fails.

QEMU_EFI reports the below error:
ProcessCmdAddPointer: invalid pointer value in "etc/acpi/tables"
OnRootBridgesConnected: InstallAcpiTables: Protocol Error

Debugging shows that on first reboot(after hot adding NVDIMM),
Qemu updates the etc/table-loader len,

qemu_ram_resize()
  fw_cfg_modify_file()
     fw_cfg_modify_bytes_read()

And in fw_cfg_modify_bytes_read() we set the "callback_opaque" for
the key entry to NULL. Because of this, on the second reboot,
virt_acpi_build_update() is called with a NULL "build_state" and
returns without updating the ACPI tables. This seems to be
upsetting the firmware.

To fix this, don't change the callback_opaque in fw_cfg_modify_bytes_read().

Fixes: bdbb5b1 ("fw_cfg: add fw_cfg_machine_reset function")
Reported-by: chenxiang <[email protected]>
Acked-by: Igor Mammedov <[email protected]>
Acked-by: Gerd Hoffmann <[email protected]>
Signed-off-by: Shameer Kolothum <[email protected]>
Message-ID: <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
  • Loading branch information
shamiali2008 authored and philmd committed Dec 31, 2024
1 parent 0798e09 commit 5a7b602
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion hw/nvram/fw_cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,6 @@ static void *fw_cfg_modify_bytes_read(FWCfgState *s, uint16_t key,
ptr = s->entries[arch][key].data;
s->entries[arch][key].data = data;
s->entries[arch][key].len = len;
s->entries[arch][key].callback_opaque = NULL;
s->entries[arch][key].allow_write = false;

return ptr;
Expand Down

0 comments on commit 5a7b602

Please sign in to comment.