Opened 12 years ago

Closed 10 years ago

#9489 closed bug (fixed)

Divide Error Exception - GPT Partition Table Driver

Reported by: kallisti5 Owned by: axeld
Priority: normal Milestone: R1
Component: Partitioning Systems/GPT Version: R1/Development
Keywords: Cc: kevinjamesfield@…, Jens.Arm@…
Blocked By: Blocking: #9603, #10009, #10376
Platform: All

Description

Insert a usb stick which used to have a gpt map on it... random kdl's.

Seems likely related to #3064 (looks like the same error on the Intel partition system driver)

Screenshot attached

Attachments (2)

IMG_20130301_103347.jpg (207.1 KB ) - added by kallisti5 12 years ago.
DSCN0454.JPG (3.2 MB ) - added by TmTFx 11 years ago.

Change History (15)

by kallisti5, 12 years ago

Attachment: IMG_20130301_103347.jpg added

comment:1 by kallisti5, 12 years ago

Blocking: 9603 added

(In #9603) ah. This is a 100% duplicate of my issue :D

#9489 shows an identical error

comment:2 by phoudoin, 12 years ago

I don't have yet a working Haiku system, but this one should be easy to fix in src/add-ons/kernel/partitioning_systems/gpt/efi_gpt.cpp:

static float
efi_gpt_identify_partition(int fd, partition_data* partition, void** _cookie)
{
+       if (partition->block_size == 0)
+           return -1;
+
	EFI::Header* header = new (std::nothrow) EFI::Header(fd,
		(partition->size - 1) / partition->block_size, partition->block_size);
	status_t status = header->InitCheck();
	if (status != B_OK) {
		delete header;
		return -1;
	}

Could some of you guys check it for me? Thanks.

comment:3 by phoudoin, 12 years ago

A better fix will to pass the whole partition_data to Header constructor and move the check in InitCheck(), though.

comment:4 by axeld, 12 years ago

I don't think the VFS should even call that method with an invalid partition. It's error prone to have these kinds of checks in every file and partitioning system.

in reply to:  4 ; comment:5 by phoudoin, 12 years ago

Replying to axeld:

I don't think the VFS should even call that method with an invalid partition. It's error prone to have these kinds of checks in every file and partitioning system.

Somehow agree. Problem is where having a 0 block_size geometry should be considering an error and avoid rescanning partitions? KDiskDeviceManager::_CheckMediaStatus() ? KDiskDeviceManager::_ScanPartitions() ? partition system modules ?

Plus, are all partition systems necessary block-based? The DDM is pretty agnostic here, letting the partition modules use the device geometry information or not...

Due to the risk that any unchecked division in kernel space pose, I'm inclined to prefer paying the price of multiple checks than the one we pay right now, a KDL.

in reply to:  5 comment:6 by kallisti5, 12 years ago

Replying to phoudoin:

Due to the risk that any unchecked division in kernel space pose, I'm inclined to prefer paying the price of multiple checks than the one we pay right now, a KDL.

This would be nice place for an assert check (and fixing the code that calls it to not call it with a 0 set.)

comment:7 by Kev, 12 years ago

Cc: kevinjamesfield@… added

comment:8 by TmTFx, 11 years ago

I have the same problem, but I have it on boot time and no usb keys nor hard disks mapped as gpt my mobo is an Asus M5A97 with uefi.

Version 0, edited 11 years ago by TmTFx (next)

comment:9 by TmTFx, 11 years ago

I forgot to say that if I boot Haiku from cd-r drive the error won't happen and it boots flawlessy. I can even install it on hard drive, but if I reboot from the fresh installation it does the same error. I post the related screenshots (it seems i cut the Divide Error Exception taking the screenshot)

Last edited 11 years ago by TmTFx (previous) (diff)

by TmTFx, 11 years ago

Attachment: DSCN0454.JPG added

comment:10 by diver, 11 years ago

Blocking: 10009 added

comment:11 by diver, 11 years ago

Blocking: 10376 added

comment:12 by jahaiku, 11 years ago

Cc: Jens.Arm@… added

I get this exception only if "Eject when unmounting" in mount options is enabled.

comment:13 by jessicah, 10 years ago

Resolution: fixed
Status: newclosed

Fixed in hrev47468.

Note: See TracTickets for help on using tickets.