Segfault in ACPI table generation if no PCI devices instantiated
Open
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 3.7k
- Forks
- 336
- PR merge metrics
- No merged PRs in 30d
Description
If hyperkit is launched with the -A flag and no PCI devices, it crashes.
In the code below, taken from src/lib/pci_emul.c, bi gets dereferenced even though it's NULL.
static void
pci_bus_write_dsdt(int bus)
{
struct businfo *bi;
/*
* If there are no devices on this 'bus' then just return.
*/
if ((bi = pci_businfo[bus]) == NULL) {
/*
* Bus 0 is special because it decodes the I/O ports used
* for PCI config space access even if there are no devices
* on it.
*/
if (bus != 0)
return;
}
dsdt_fixup(bus, bi->iobase, bi->iolimit, bi->membase32, bi->memlimit32,
bi->membase64, bi->memlimit64);
(void) pci_pirq_prt_entry;
(void) pci_apic_prt_entry;
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/lib/pci_emul.c, at pci_bus_write_dsdt, and reproduce hyperkit with the -A flag and no PCI devices. Trace the no-device Bus 0 path and verify that ACPI table generation completes without a segmentation fault when the fix is done.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100