Opened 10 years ago

Closed 2 years ago

#11929 closed bug (not reproducible)

PackageVolumeInfo template usage results in crash on non-PM TARFS initrd

Reported by: kallisti5 Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: System/Boot Loader Version: R1/Development
Keywords: arm tarfs Cc:
Blocked By: Blocking:
Platform: arm

Description (last modified by kallisti5)

No idea what the solution is. In theory we should fall through the "apparently not packaged" if, but don't make it there.

In src/system/boot/loader/vfs.cpp

        BReference<PackageVolumeInfo> packageVolumeInfoReference(
            new(std::nothrow) PackageVolumeInfo);

In src/system/boot/loader/vfs.cpp

status_t
BootVolume::_SetTo(Directory* rootDirectory,
    PackageVolumeInfo* packageVolumeInfo,
    PackageVolumeState* packageVolumeState)
{
    TRACE(("QUACK2.0\n"));
    Unset();

    TRACE(("QUACK2.1\n"));
    if (rootDirectory == NULL)
        return B_BAD_VALUE;

    fRootDirectory = rootDirectory;
    fRootDirectory->Acquire();

    TRACE(("QUACK2.2\n"));
    // find the system directory
    Node* systemNode = fRootDirectory->Lookup("system", true);
    if (systemNode == NULL || !S_ISDIR(systemNode->Type())) {
        if (systemNode != NULL)
            systemNode->Release();
        Unset();
        return B_ENTRY_NOT_FOUND;
    }
    TRACE(("QUACK2.3\n"));

    fSystemDirectory = static_cast<Directory*>(systemNode);

    TRACE(("QUACK2.4\n"));

    if (packageVolumeInfo == NULL) {
        TRACE(("QUACK2.5.1\n"));
        // get a package volume info 
        BReference<PackageVolumeInfo> packageVolumeInfoReference(
            new(std::nothrow) PackageVolumeInfo);
        TRACE(("QUACK2.5.2\n"));
        status_t error = packageVolumeInfoReference->SetTo(fSystemDirectory,
            "packages");
        TRACE(("QUACK2.5.3\n"));
        if (error != B_OK) {
            // apparently not packaged
            return B_OK;
        }

        fPackageVolumeInfo = packageVolumeInfoReference.Detach();
    } else {
        TRACE(("QUACK2.6.1\n"));
        fPackageVolumeInfo = packageVolumeInfo;
        fPackageVolumeInfo->AcquireReference();
        TRACE(("QUACK2.6.2\n"));
    }

Result:

tarfs: "system/add-ons/kernel/boot/silicon_image_3112", 0 bytes
tarfs: "system/add-ons/kernel/boot/legacy_sata", 0 bytes
tarfs: "system/add-ons/kernel/boot/it8211", 0 bytes
tarfs: "system/add-ons/kernel/boot/uhci", 0 bytes
tarfs: "system/add-ons/kernel/boot/ohci", 0 bytes
tarfs: "system/add-ons/kernel/boot/ehci", 0 bytes
tarfs: "system/add-ons/kernel/boot/scsi_cd", 0 bytes
tarfs: "system/add-ons/kernel/boot/scsi_disk", 0 bytes
tarfs: "system/add-ons/kernel/boot/usb_disk", 0 bytes
tarfs: "system/add-ons/kernel/boot/norflash", 0 bytes
tarfs: "system/add-ons/kernel/boot/intel", 0 bytes
tarfs: "system/add-ons/kernel/boot/session", 0 bytes
tarfs: "system/add-ons/kernel/boot/attribute_overlay", 0 bytes
tarfs: "system/add-ons/kernel/boot/bfs", 0 bytes
tarfs: "system/add-ons/kernel/boot/iso9660", 0 bytes
tarfs: "system/add-ons/kernel/boot/packagefs", 0 bytes
tarfs: "system/add-ons/kernel/boot/write_overlay", 0 bytes
tarfs: "system/kernel_arm", 2165897 bytes
0x8098e1e0::Close()
0x8098e1e0::Release(), fRefCount = 2
0x8098e270::Acquire(), fRefCount = 2
QUACK1
QUACK2.0
QUACK2.1
0x8098e270::Acquire(), fRefCount = 3
QUACK2.2
0x8098e580::Acquire(), fRefCount = 2
QUACK2.3
QUACK2.4
QUACK2.5.1
<LOCKUP>

Attachments (1)

uartOutMMUTrace.txt (358.5 KB ) - added by kallisti5 10 years ago.
mmu trace boot rpi 2

Download all attachments as: .zip

Change History (9)

comment:1 by kallisti5, 10 years ago

Description: modified (diff)

comment:2 by kallisti5, 10 years ago

I should note, adding a "return B_OK" just above QUACK2.5.1 results in the loader getting to loading the kernel elf from the tar!

got descriptor 1 for node 0x8098f700
0x8098f700::Open()
0x8098f700::Acquire(), fRefCount = 3
could open node at 0x8098f700
0x8098f700::Release(), fRefCount = 3
load kernel kernel_arm...
elf_load_image(fd = 1, _image = 0x000ce32c)
tarfs: read at 0, 52 bytes, fSize = 2165897
<LOCKUP>

comment:4 by bonefish, 10 years ago

Cc: ingo_weinhold@… removed

Since the PackageVolumeInfo effectively doesn't do anything, apparently the memory allocation causes the lockup. So my bet would be on a bug in the memory allocator or -- more likely -- in the ARM memory management code.

comment:5 by kallisti5, 10 years ago

Thanks @bonefish.

The issue is that everything mapped looks valid to my eyes. Anyone see anything off? (attached boot with full mmu tracing)

by kallisti5, 10 years ago

Attachment: uartOutMMUTrace.txt added

mmu trace boot rpi 2

comment:6 by axeld, 8 years ago

Owner: changed from axeld to nobody
Status: newassigned

comment:7 by davidkaroly, 2 years ago

Is this still valid? Looks like something related to the raw u-boot loader which does not exist any more.

comment:8 by pulkomandy, 2 years ago

Resolution: not reproducible
Status: assignedclosed

It probably was a too small heap size and running out of memory. Marking as not reproducible for now.

Note: See TracTickets for help on using tickets.