qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/1] fix dumpdtb crash with ARM machines
@ 2023-03-23 20:44 Daniel Henrique Barboza
  2023-03-23 20:44 ` [PATCH v2 1/1] hw/arm: do not free machine->fdt in arm_load_dtb() Daniel Henrique Barboza
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Henrique Barboza @ 2023-03-23 20:44 UTC (permalink / raw)
  To: qemu-devel
  Cc: Daniel Henrique Barboza, Peter Maydell, Markus Armbruster,
	qemu-arm

Hi,

In this version I fixed a mem leak that was happening if the user inputs
a fdt via '-dtb'. In that case we would assign the updated FDT on top of
the existing board FDT that was already assigned to ms->fdt.

Tested as follows:

$ ./qemu-system-aarch64 -S -M virt -display none -qmp stdio
{"QMP": {"version": {"qemu": {"micro": 91, "minor": 2, "major": 7}, "package": "v8.0.0-rc1-37-ge573ef31e7-dirty"}, "capabilities": ["oob"]}}
{"execute": "qmp_capabilities", "arguments": {"enable": ["oob"]}}
{"return": {}}

{"execute": "dumpdtb", "arguments": {"filename": "fdt.dtb"}}
{"return": {}}

^Cqemu-system-aarch64: terminating on signal 2
{"timestamp": {"seconds": 1679603324, "microseconds": 62159}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-signal"}}
$ 


$ ./qemu-system-aarch64 -S -M virt -display none -qmp stdio -dtb fdt.dtb 
{"QMP": {"version": {"qemu": {"micro": 91, "minor": 2, "major": 7}, "package": "v8.0.0-rc1-37-ge573ef31e7-dirty"}, "capabilities": ["oob"]}}
{"execute": "qmp_capabilities", "arguments": {"enable": ["oob"]}}
{"return": {}}

{"execute": "dumpdtb", "arguments": {"filename": "fdt.dtb"}}
{"return": {}}
^Cqemu-system-aarch64: terminating on signal 2
{"timestamp": {"seconds": 1679603344, "microseconds": 145748}, "event": "SHUTDOWN", "data": {"guest": false, "reason": "host-signal"}}
$ 


First we use 'dumpdtb' to dump the board FDT in fdt.dtb, then we use it as
an argument to '-dtb' and do the test again. This covers both code paths.


Changes from v1:
- g_free(ms->fdt) before load_device_tree()
- v1 link: https://lists.gnu.org/archive/html/qemu-devel/2023-03/msg05930.html

Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Markus Armbruster <armbru@redhat.com>
Cc: qemu-arm@nongnu.org

Daniel Henrique Barboza (1):
  hw/arm: do not free machine->fdt in arm_load_dtb()

 hw/arm/boot.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

-- 
2.39.2



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

end of thread, other threads:[~2023-03-28 16:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-23 20:44 [PATCH v2 0/1] fix dumpdtb crash with ARM machines Daniel Henrique Barboza
2023-03-23 20:44 ` [PATCH v2 1/1] hw/arm: do not free machine->fdt in arm_load_dtb() Daniel Henrique Barboza
2023-03-28  7:01   ` Markus Armbruster
2023-03-28  9:34     ` Daniel Henrique Barboza
2023-03-28  9:53       ` Markus Armbruster
2023-03-28 12:54         ` Daniel Henrique Barboza
2023-03-28 16:58           ` Markus Armbruster

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