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.

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 OK
Unit
No Unit Test Coverage

Event Timeline

jhb updated this revision to Diff 6136.Jun 12 2015, 1:15 PM
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.
marius edited edge metadata.Jun 14 2015, 9:40 PM

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.

jhb added a comment.Aug 1 2015, 5:54 PM
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 updated this revision to Diff 7732.Aug 6 2015, 6:09 PM
jhb edited edge metadata.
  • Retire the fire/psycho/schizo NRANGE and use an OFW constant instead.
danfe added a subscriber: danfe.Sep 6 2015, 11:06 AM

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.

jhb abandoned this revision.Sep 14 2015, 10:08 PM

@marius included these changes in rS287726