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)
Wed, Dec 4, 2:18 AM
Unknown Object (File)
Nov 21 2024, 4:45 PM
Unknown Object (File)
Nov 20 2024, 5:40 PM
Unknown Object (File)
Nov 6 2024, 9:45 PM
Unknown Object (File)
Oct 23 2024, 2:35 PM
Unknown Object (File)
Oct 17 2024, 11:05 AM
Unknown Object (File)
Oct 17 2024, 2:22 AM
Unknown Object (File)
Oct 15 2024, 4:54 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.