/openbmc/qemu/hw/i386/ |
H A D | e820_memory_layout.c | diff 93c76555d842b5d84b95f66abecb6b19545338d9 Wed Jun 19 08:03:08 CDT 2024 David Woodhouse <dwmw2@infradead.org> hw/i386/fw_cfg: Add etc/e820 to fw_cfg late
In e820_add_entry() the e820_table is reallocated with g_renew() to make space for a new entry. However, fw_cfg_arch_create() just uses the existing e820_table pointer. This leads to a use-after-free if anything adds a new entry after fw_cfg is set up.
Shift the addition of the etc/e820 file to the machine done notifier, via a new fw_cfg_add_e820() function.
Also make e820_table private and use an e820_get_table() accessor function for it, which sets a flag that will trigger an assert() for any *later* attempts to add to the table.
Make e820_add_entry() return void, as most callers don't check for error anyway.
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Message-Id: <a2708734f004b224f33d3b4824e9a5a262431568.camel@infradead.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
H A D | e820_memory_layout.h | diff 93c76555d842b5d84b95f66abecb6b19545338d9 Wed Jun 19 08:03:08 CDT 2024 David Woodhouse <dwmw2@infradead.org> hw/i386/fw_cfg: Add etc/e820 to fw_cfg late
In e820_add_entry() the e820_table is reallocated with g_renew() to make space for a new entry. However, fw_cfg_arch_create() just uses the existing e820_table pointer. This leads to a use-after-free if anything adds a new entry after fw_cfg is set up.
Shift the addition of the etc/e820 file to the machine done notifier, via a new fw_cfg_add_e820() function.
Also make e820_table private and use an e820_get_table() accessor function for it, which sets a flag that will trigger an assert() for any *later* attempts to add to the table.
Make e820_add_entry() return void, as most callers don't check for error anyway.
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Message-Id: <a2708734f004b224f33d3b4824e9a5a262431568.camel@infradead.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
H A D | fw_cfg.h | diff 93c76555d842b5d84b95f66abecb6b19545338d9 Wed Jun 19 08:03:08 CDT 2024 David Woodhouse <dwmw2@infradead.org> hw/i386/fw_cfg: Add etc/e820 to fw_cfg late
In e820_add_entry() the e820_table is reallocated with g_renew() to make space for a new entry. However, fw_cfg_arch_create() just uses the existing e820_table pointer. This leads to a use-after-free if anything adds a new entry after fw_cfg is set up.
Shift the addition of the etc/e820 file to the machine done notifier, via a new fw_cfg_add_e820() function.
Also make e820_table private and use an e820_get_table() accessor function for it, which sets a flag that will trigger an assert() for any *later* attempts to add to the table.
Make e820_add_entry() return void, as most callers don't check for error anyway.
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Message-Id: <a2708734f004b224f33d3b4824e9a5a262431568.camel@infradead.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
H A D | fw_cfg.c | diff 93c76555d842b5d84b95f66abecb6b19545338d9 Wed Jun 19 08:03:08 CDT 2024 David Woodhouse <dwmw2@infradead.org> hw/i386/fw_cfg: Add etc/e820 to fw_cfg late
In e820_add_entry() the e820_table is reallocated with g_renew() to make space for a new entry. However, fw_cfg_arch_create() just uses the existing e820_table pointer. This leads to a use-after-free if anything adds a new entry after fw_cfg is set up.
Shift the addition of the etc/e820 file to the machine done notifier, via a new fw_cfg_add_e820() function.
Also make e820_table private and use an e820_get_table() accessor function for it, which sets a flag that will trigger an assert() for any *later* attempts to add to the table.
Make e820_add_entry() return void, as most callers don't check for error anyway.
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Message-Id: <a2708734f004b224f33d3b4824e9a5a262431568.camel@infradead.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
H A D | microvm.c | diff 93c76555d842b5d84b95f66abecb6b19545338d9 Wed Jun 19 08:03:08 CDT 2024 David Woodhouse <dwmw2@infradead.org> hw/i386/fw_cfg: Add etc/e820 to fw_cfg late
In e820_add_entry() the e820_table is reallocated with g_renew() to make space for a new entry. However, fw_cfg_arch_create() just uses the existing e820_table pointer. This leads to a use-after-free if anything adds a new entry after fw_cfg is set up.
Shift the addition of the etc/e820 file to the machine done notifier, via a new fw_cfg_add_e820() function.
Also make e820_table private and use an e820_get_table() accessor function for it, which sets a flag that will trigger an assert() for any *later* attempts to add to the table.
Make e820_add_entry() return void, as most callers don't check for error anyway.
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Message-Id: <a2708734f004b224f33d3b4824e9a5a262431568.camel@infradead.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
H A D | pc.c | diff 93c76555d842b5d84b95f66abecb6b19545338d9 Wed Jun 19 08:03:08 CDT 2024 David Woodhouse <dwmw2@infradead.org> hw/i386/fw_cfg: Add etc/e820 to fw_cfg late
In e820_add_entry() the e820_table is reallocated with g_renew() to make space for a new entry. However, fw_cfg_arch_create() just uses the existing e820_table pointer. This leads to a use-after-free if anything adds a new entry after fw_cfg is set up.
Shift the addition of the etc/e820 file to the machine done notifier, via a new fw_cfg_add_e820() function.
Also make e820_table private and use an e820_get_table() accessor function for it, which sets a flag that will trigger an assert() for any *later* attempts to add to the table.
Make e820_add_entry() return void, as most callers don't check for error anyway.
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Message-Id: <a2708734f004b224f33d3b4824e9a5a262431568.camel@infradead.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
/openbmc/qemu/target/i386/kvm/ |
H A D | xen-emu.c | diff 93c76555d842b5d84b95f66abecb6b19545338d9 Wed Jun 19 08:03:08 CDT 2024 David Woodhouse <dwmw2@infradead.org> hw/i386/fw_cfg: Add etc/e820 to fw_cfg late
In e820_add_entry() the e820_table is reallocated with g_renew() to make space for a new entry. However, fw_cfg_arch_create() just uses the existing e820_table pointer. This leads to a use-after-free if anything adds a new entry after fw_cfg is set up.
Shift the addition of the etc/e820 file to the machine done notifier, via a new fw_cfg_add_e820() function.
Also make e820_table private and use an e820_get_table() accessor function for it, which sets a flag that will trigger an assert() for any *later* attempts to add to the table.
Make e820_add_entry() return void, as most callers don't check for error anyway.
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Message-Id: <a2708734f004b224f33d3b4824e9a5a262431568.camel@infradead.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
H A D | kvm.c | diff 93c76555d842b5d84b95f66abecb6b19545338d9 Wed Jun 19 08:03:08 CDT 2024 David Woodhouse <dwmw2@infradead.org> hw/i386/fw_cfg: Add etc/e820 to fw_cfg late
In e820_add_entry() the e820_table is reallocated with g_renew() to make space for a new entry. However, fw_cfg_arch_create() just uses the existing e820_table pointer. This leads to a use-after-free if anything adds a new entry after fw_cfg is set up.
Shift the addition of the etc/e820 file to the machine done notifier, via a new fw_cfg_add_e820() function.
Also make e820_table private and use an e820_get_table() accessor function for it, which sets a flag that will trigger an assert() for any *later* attempts to add to the table.
Make e820_add_entry() return void, as most callers don't check for error anyway.
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk> Message-Id: <a2708734f004b224f33d3b4824e9a5a262431568.camel@infradead.org> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|