Page MenuHomeFreeBSD

libdevinfo: Avoid false positives for the root0 sentinel value
AcceptedPublic

Authored by jhb on Sat, Jan 25, 2:42 AM.

Details

Reviewers
imp
jrtc27
Summary

Previously, a NULL pointer value was used to request the root0 device
at the top of the device tree. However, this meant that resource
ranges from a rman with a NULL device pointer were annotated as being
owned by root0 instead of being unowned. Switch to a different value
for root0's sentinel to avoid the clash.

Since this is an ABI change, bump the SHLIB_MAJOR for libdevinfo to 7.

Reported by: jrtc27

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 62018
Build 58902: arc lint + arc unit

Event Timeline

jhb requested review of this revision.Sat, Jan 25, 2:42 AM
jhb created this revision.

Before in a VM:

# devinfo -u
Interrupt request lines:
    0x0 (attimer0)
    0x1 (atkbdc0)
    0x3 (uart3)
    0x3 (uart1)
    0x4 (uart2)
    0x4 (uart0)
    0x5-0x7 (root0)
    0x8 (atrtc0)
    0x9 (acpi0)
    0xa-0xb (root0)
    0xc (psm0)
    0xd-0x1f (root0)
    0x20 (hpet0)
    0x21 (hpet0)
    0x22 (hpet0)
    0x23 (hpet0)
    0x24 (hpet0)
    0x25 (hpet0)
    0x26 (hpet0)
    0x27 (hpet0)
    0x28 (virtio_pci0)
    0x29 (virtio_pci0)
    0x2a (virtio_pci1)
    0x2b (virtio_pci1)
    0x2c (virtio_pci1)
    0x2d (nvme0)
    0x2e (nvme0)
    0x2f (nvme0)
    0x30 (nvme0)
    0x31 (nvme0)
    0x32 (nvme0)
    0x33 (nvme0)
    0x34 (nvme0)
    0x35 (nvme0)
    0x36 (nvme0)
    0x37 (nvme0)
    0x38 (nvme0)
    0x39 (nvme0)
    0x3a (nvme0)
    0x3b (nvme0)
    0x3c (nvme0)
    0x3d (nvme0)
DMA request lines:
    0-7 (root0)
I/O ports:
    0x0-0x1f (root0)
    0x20-0x21 ----
    0x22-0x3f (root0)
    0x40-0x43 (attimer0)
    0x44-0x5f (root0)
    0x60 (atkbdc0)
    0x61 (acpi0)
    0x62-0x63 (root0)
    0x64 (atkbdc0)
    0x65-0x6f (root0)
    0x70-0x71 (atrtc0)
    0x72-0x77 (acpi0)
    0x78-0x83 (root0)
    0x84 (acpi0)
    0x85-0x9f (root0)
    0xa0-0xa1 ----
    0xa2-0xb1 (root0)
    0xb2 (acpi0)
    0xb3-0x2e7 (root0)
    0x2e8-0x2ef (uart3)
    0x2f0-0x2f7 (root0)
    0x2f8-0x2ff (uart1)
    0x300-0x3af (root0)
    0x3b0-0x3bb (vga0)
    0x3bc-0x3e7 (root0)
    0x3e8-0x3ef (uart2)
    0x3f0-0x3f7 (root0)
    0x3f8-0x3ff (uart0)
    0x400-0x407 (acpi0)
    0x408-0x40b (acpi_timer0)
    0x40c-0x4cf (root0)
    0x4d0-0x4d1 (acpi0)
    0x4d2-0xcf7 (root0)
    0xcf8-0xcff (pcib0)
    0xd00-0x1fff (root0)
    0x2000-0x207f (virtio_pci0)
    0x2080-0x20bf (virtio_pci1)
    0x20c0-0x20df (virtio_pci2)
    0x20e0-0xffff (root0)
I/O memory addresses:
    0x0-0x9ffff (ram0)
    0xa0000-0xaffff (root0)
    0xb0000-0xb7fff (vga0)
    0xb8000-0xfffff (root0)
    0x100000-0xbfffffff (ram0)
    0xc0000000-0xc0003fff (nvme0)
    0xc0004000-0xc0005fff (virtio_pci0)
    0xc0006000-0xc0007fff (virtio_pci1)
    0xc0008000-0xc0009fff (virtio_pci2)
    0xc000a000-0xc000bfff (nvme0)
    0xc000c000-0xdfffffff (root0)
    0xe0000000-0xefffffff (acpi0)
    0xf0000000-0xfebfffff (root0)
    0xfec00000-0xfec0001f (apic0)
    0xfec00020-0xfecfffff (root0)
    0xfed00000-0xfed003ff (hpet0)
    0xfed00400-0xfedfffff (root0)
    0xfee00000-0xfee0053f (apic0)
    0xfee00540-0xffffffff (root0)
    0x100000000-0x43fffffff (ram0)
    0x440000000-0xffffffffffff (root0)
ACPI I/O ports:
    0x61 (root0)
    0x72-0x77 (root0)
    0x84 (root0)
    0xb2 (root0)
    0x400-0x407 (root0)
    0x4d0-0x4d1 (root0)
ACPI I/O memory addresses:
    0xe0000000-0xefffffff (root0)
PCI domain 0 bus numbers:
    0 (pci0)
    1-255 (root0)

after:

# devinfo -u
Interrupt request lines:
    0x0 (attimer0)
    0x1 (atkbdc0)
    0x3 (uart3)
    0x3 (uart1)
    0x4 (uart2)
    0x4 (uart0)
    0x5-0x7 ----
    0x8 (atrtc0)
    0x9 (acpi0)
    0xa-0xb ----
    0xc (psm0)
    0xd-0x1f ----
    0x20 (hpet0)
    0x21 (hpet0)
    0x22 (hpet0)
    0x23 (hpet0)
    0x24 (hpet0)
    0x25 (hpet0)
    0x26 (hpet0)
    0x27 (hpet0)
    0x28 (virtio_pci0)
    0x29 (virtio_pci0)
    0x2a (virtio_pci1)
    0x2b (virtio_pci1)
    0x2c (virtio_pci1)
    0x2d (nvme0)
    0x2e (nvme0)
    0x2f (nvme0)
    0x30 (nvme0)
    0x31 (nvme0)
    0x32 (nvme0)
    0x33 (nvme0)
    0x34 (nvme0)
    0x35 (nvme0)
    0x36 (nvme0)
    0x37 (nvme0)
    0x38 (nvme0)
    0x39 (nvme0)
    0x3a (nvme0)
    0x3b (nvme0)
    0x3c (nvme0)
    0x3d (nvme0)
DMA request lines:
    0-7 ----
I/O ports:
    0x0-0x1f ----
    0x20-0x21 ----
    0x22-0x3f ----
    0x40-0x43 (attimer0)
    0x44-0x5f ----
    0x60 (atkbdc0)
    0x61 (acpi0)
    0x62-0x63 ----
    0x64 (atkbdc0)
    0x65-0x6f ----
    0x70-0x71 (atrtc0)
    0x72-0x77 (acpi0)
    0x78-0x83 ----
    0x84 (acpi0)
    0x85-0x9f ----
    0xa0-0xa1 ----
    0xa2-0xb1 ----
    0xb2 (acpi0)
    0xb3-0x2e7 ----
    0x2e8-0x2ef (uart3)
    0x2f0-0x2f7 ----
    0x2f8-0x2ff (uart1)
    0x300-0x3af ----
    0x3b0-0x3bb (vga0)
    0x3bc-0x3e7 ----
    0x3e8-0x3ef (uart2)
    0x3f0-0x3f7 ----
    0x3f8-0x3ff (uart0)
    0x400-0x407 (acpi0)
    0x408-0x40b (acpi_timer0)
    0x40c-0x4cf ----
    0x4d0-0x4d1 (acpi0)
    0x4d2-0xcf7 ----
    0xcf8-0xcff (pcib0)
    0xd00-0x1fff ----
    0x2000-0x207f (virtio_pci0)
    0x2080-0x20bf (virtio_pci1)
    0x20c0-0x20df (virtio_pci2)
    0x20e0-0xffff ----
I/O memory addresses:
    0x0-0x9ffff (ram0)
    0xa0000-0xaffff ----
    0xb0000-0xb7fff (vga0)
    0xb8000-0xfffff ----
    0x100000-0xbfffffff (ram0)
    0xc0000000-0xc0003fff (nvme0)
    0xc0004000-0xc0005fff (virtio_pci0)
    0xc0006000-0xc0007fff (virtio_pci1)
    0xc0008000-0xc0009fff (virtio_pci2)
    0xc000a000-0xc000bfff (nvme0)
    0xc000c000-0xdfffffff ----
    0xe0000000-0xefffffff (acpi0)
    0xf0000000-0xfebfffff ----
    0xfec00000-0xfec0001f (apic0)
    0xfec00020-0xfecfffff ----
    0xfed00000-0xfed003ff (hpet0)
    0xfed00400-0xfedfffff ----
    0xfee00000-0xfee0053f (apic0)
    0xfee00540-0xffffffff ----
    0x100000000-0x43fffffff (ram0)
    0x440000000-0xffffffffffff ----
ACPI I/O ports:
    0x61 ----
    0x72-0x77 ----
    0x84 ----
    0xb2 ----
    0x400-0x407 ----
    0x4d0-0x4d1 ----
ACPI I/O memory addresses:
    0xe0000000-0xefffffff ----
PCI domain 0 bus numbers:
    0 (pci0)
    1-255 ----
imp added inline comments.
lib/libdevinfo/devinfo.h
37

why 1?

This revision is now accepted and ready to land.Sun, Jan 26, 3:53 AM