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, Apr 13, 7:38 PM
Unknown Object (File)
Sat, Apr 13, 7:38 PM
Unknown Object (File)
Mar 14 2024, 4:28 PM
Unknown Object (File)
Mar 14 2024, 3:57 PM
Unknown Object (File)
Mar 2 2024, 10:12 PM
Unknown Object (File)
Jan 19 2024, 3:39 PM
Unknown Object (File)
Jan 10 2024, 11:49 AM
Unknown Object (File)
Jan 10 2024, 11:49 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

Repository
rS FreeBSD src repository - subversion
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.