Opened 17 years ago

Closed 17 years ago

Last modified 17 years ago

#1672 closed bug (fixed)

Bootmenu triggers reboot

Reported by: marcusoverhagen Owned by: axeld
Priority: blocker Milestone: R1/alpha1
Component: System/Boot Loader Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

Entering the Haiku bootmenu triggers a reboot after leaving it. On my machine this has always been reproducible.

I've tracked down an access to a destroyed Partition object by the boot loader in src/system/boot/loader/loader.cpp

load_modules(stage2_args *args, Directory *volume) does

// iterate over the mounted volumes and load their file system
Partition *partition;
if (gRoot->GetPartitionFor(volume, &partition) == B_OK) {
   while (partition != NULL) {
      load_module(volume, partition->ModuleName());
      partition = partition->Parent();
   }
}

This partition pointer gets invalid and triggers a reboot, because Parent() does return an object that has been destroyed before the boot menu was shown. Thus the object has been overwritten by the boot menu code.

This can be seen in haikupartitions2.txt, the pointer is 0x0010971c

This problem doesn't seem to happen at all when not entering the bootmenu, see haikupartitions1.txt for reference.

Attachments (2)

haikupartitions1.txt (115.2 KB ) - added by marcusoverhagen 17 years ago.
normal boot without bootmenu
haikupartitions2.txt (15.7 KB ) - added by marcusoverhagen 17 years ago.
bootmenu and reboot

Download all attachments as: .zip

Change History (7)

by marcusoverhagen, 17 years ago

Attachment: haikupartitions1.txt added

normal boot without bootmenu

by marcusoverhagen, 17 years ago

Attachment: haikupartitions2.txt added

bootmenu and reboot

comment:1 by axeld, 17 years ago

Status: newassigned

Thanks for investigating this, I'll have a look!

comment:2 by axeld, 17 years ago

Does hrev23172 help for you? I have a similar problem on my laptop (only boots when the boot menu is not used), but it seems to be a different problem. This might be a duplicate of #690, though.

comment:3 by marcusoverhagen, 17 years ago

Yes this fixes the problem.

However, I'm not sure if this code in partitions.cpp is save:

// move the partitions containing file systems to the partition
// list
fChildren.Remove(child);
gPartitions.Add(child);

comment:4 by axeld, 17 years ago

Resolution: fixed
Status: assignedclosed

Thanks for the update! The list iterator is safe to be used in this context, and the parent pointer is not affected by this code.

comment:5 by axeld, 17 years ago

Confirmed to be a duplicate of #690.

Note: See TracTickets for help on using tickets.