Opened 6 years ago

Closed 5 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
Has a Patch: no 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 6 years ago.
DSCN0454.JPG (3.2 MB) - added by TmTFx 6 years ago.

Change History (15)

Changed 6 years ago by kallisti5

Attachment: IMG_20130301_103347.jpg added

comment:1 Changed 6 years ago by kallisti5

Blocking: 9603 added

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

#9489 shows an identical error

comment:2 Changed 6 years ago by phoudoin

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 Changed 6 years ago by phoudoin

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

comment:4 Changed 6 years ago by 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.

comment:5 in reply to:  4 ; Changed 6 years ago by phoudoin

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.

comment:6 in reply to:  5 Changed 6 years ago by kallisti5

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 Changed 6 years ago by Kev

Cc: kevinjamesfield@… added

comment:8 Changed 6 years ago by TmTFx

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 R2.0 with uefi.

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

comment:9 Changed 6 years ago by TmTFx

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 6 years ago by TmTFx (previous) (diff)

Changed 6 years ago by TmTFx

Attachment: DSCN0454.JPG added

comment:10 Changed 6 years ago by diver

Blocking: 10009 added

comment:11 Changed 6 years ago by diver

Blocking: 10376 added

comment:12 Changed 6 years ago by jahaiku

Cc: Jens.Arm@… added

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

comment:13 Changed 5 years ago by jessicah

Resolution: fixed
Status: newclosed

Fixed in hrev47468.

Note: See TracTickets for help on using tickets.