Page MenuHomeFreeBSD

Don't panic if the MEM64 range is not present as qemu does not include it.
AbandonedPublic

Authored by jhb on Jun 12 2015, 1:15 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jun 22, 4:44 AM
Unknown Object (File)
Fri, Jun 21, 3:18 AM
Unknown Object (File)
Fri, Jun 21, 2:30 AM
Unknown Object (File)
Sun, Jun 2, 2:25 PM
Unknown Object (File)
May 13 2024, 11:21 PM
Unknown Object (File)
May 7 2024, 5:04 AM
Unknown Object (File)
May 6 2024, 3:19 PM
Unknown Object (File)
May 6 2024, 4:13 AM

Details

Reviewers
marius
Summary

This fixes the panic in qemu, though now the system appears to hang in
qemu before getting into single user mode.

Test Plan
  • boot a HEAD ISO with and without the patch in qemu

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage

Event Timeline

jhb retitled this revision from to Don't panic if the MEM64 range is not present as qemu does not include it..
jhb updated this object.
jhb edited the test plan for this revision. (Show Details)
jhb added a reviewer: marius.

Generally looks okay. However, you should keep the check for an unsupported number of ranges but change it to ensure that the device tree doesn't include more than PSYCHO_NRANGE, i. e. 4, ranges or alternatively additionally limit the loop to PSYCHO_NRANGE. Otherwise, a device tree having more than 4 ranges would now cause an out-of-bounds array access.

In D2791#54023, @marius wrote:

Generally looks okay. However, you should keep the check for an unsupported number of ranges but change it to ensure that the device tree doesn't include more than PSYCHO_NRANGE, i. e. 4, ranges or alternatively additionally limit the loop to PSYCHO_NRANGE. Otherwise, a device tree having more than 4 ranges would now cause an out-of-bounds array access.

The range[] array is dynamically allocated, so there shouldn't be an out-of-range access by the for loop, yes? The pci_bh[] array is only indexed by the result of OFW_PCI_RANGE_CS() and that only returns values 0 through 3.

Hmm, looks like the fire and schizo drivers have the same code. It seems like STX_NRANGE and friends should really be replaced by an OFW_PCI_NRANGE constant since those arrays are indexed by OFW_PCI_RANGE_CS values, not the indices of the raw ranges property.

jhb edited edge metadata.
  • Retire the fire/psycho/schizo NRANGE and use an OFW constant instead.

Thanks for the patch, it does fix the psycho panic in qemu for me as well (the kernel still hangs at some later stage); tested against fresh -CURRENT sources.