Project

General

Profile

Bug #9699

loader: biosdisk should prefer smaller (safer) sectors value from INT13

Added by Toomas Soome over 1 year ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
bootloader
Start date:
2018-08-03
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:

Description

FreeBSD update: https://reviews.freebsd.org/D16577

When a Mediasonic HD3-U2B-ME PATA to USB enclosure with a disk is attached, loader hangs at line 506 of stand/i386/libi386/biosdisk.c while attempting to read sectors beyond the end of the disk, sector 156906855. I discovered that the Mediasonic enclosure was reporting the disk with 9767 cylinders, 255 heads, 63 sectors/track. That's 156906855 sectors. However camcontrol and Windows 10 both report report the disk having 156301488 sectors, not the calculated value. At line 280 biosdisk.c sets the sectors to the higher of either bd->bd_sectors or the total calculated at line 276 (156906855) instead of the lower and correct value of 156301488 reported by int 13h 48h.

Instead of using the higher of bd_sectors, returned by int13, or the calculated value, this patch uses the safer lower value.

This has been tested using two separate drives in Mediasonic HD3-U2B-ME enclosures resolving the hang in loader at boot time.

History

#1

Updated by Electric Monk over 1 year ago

  • % Done changed from 90 to 100
  • Status changed from In Progress to Closed

git commit 570479901769888c6a35dcd8d94242a926d0bd87

commit  570479901769888c6a35dcd8d94242a926d0bd87
Author: Toomas Soome <tsoome@me.com>
Date:   2018-08-29T02:07:12.000Z

    9699 loader: biosdisk should prefer smaller (safer) sectors value from INT13
    Reviewed by: Andy Fiddaman <omnios@citrus-it.co.uk>
    Reviewed by: Yuri Pankov <yuripv@yuripv.net>
    Approved by: Robert Mustacchi <rm@joyent.com>

Also available in: Atom PDF