Bug 236585 - BTX Halted upgrading FreeBSD 11.2 UFS from r344213 to r345199
Summary: BTX Halted upgrading FreeBSD 11.2 UFS from r344213 to r345199
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 11.2-STABLE
Hardware: amd64 Any
: --- Affects Some People
Assignee: Toomas Soome
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2019-03-17 04:32 UTC by john
Modified: 2019-05-06 08:57 UTC (History)
1 user (show)

See Also:
koobs: mfc-stable12?
koobs: mfc-stable11?


Attachments
Patch for crash (427 bytes, patch)
2019-03-18 03:34 UTC, john
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description john 2019-03-17 04:32:11 UTC
I periodically do:

  svn update
  make buildworld
  make kernel
  reboot
  ...
  make installworld
  ...
  reboot

Did one around Feb 16 at r344213, just before boot updates.  No problems.

Did one on Mar 16 at r345199.  First reboot (after installing the new
kernel) was fine.  Second reboot (after the installing world) gives
BTX Halted.  Booting using loader.old works fine and works around the
issue.

System dual boots Windows 7 and FreeBSD.  I'm using a sata hard drive
with UFS ...  here's the gpart show:

  =>        63  3907029105  ada0  MBR  (1.8T)
            63      204800     1  ntfs  (100M)
        204863        3982        - free -  (1.9M)
        208845  1551620096     2  ntfs  (740G)
    1551828941        1864        - free -  (932K)
    1551830805   491508675     3  ntfs  (234G)
    2043339480        7497        - free -  (3.7M)
    2043346977  1862270928     4  freebsd  [active]  (888G)
    3905617905     1411263        - free -  (689M)
 
  =>         0  1862270928  ada0s4  BSD  (888G)
             0     2097152       1  freebsd-ufs  (1.0G)
       2097152    33554432       2  freebsd-swap  (16G)
      35651584    20971520       5  freebsd-ufs  (10G)
      56623104    41943040       6  freebsd-ufs  (20G)
      98566144  1763704783       7  freebsd-ufs  (841G)
    1862270927           1          - free -  (512B)
 
System also has a memory card reader with no cards inserted.  Here's part
of the dmesg regarding the drives:
 
  ada0 at ahcich0 bus 0 scbus0 target 0 lun 0
  ada0: <ST2000NM0008-2F3100 SN02> ACS-3 ATA SATA 3.x device
  ada0: Serial Number ZDS09QFC
  ada0: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes)
  ada0: Command Queueing enabled
  ada0: 1907729MB (3907029168 512 byte sectors)
  Trying to mount root from ufs:/dev/ada0s4a [rw]...
  da0 at umass-sim0 bus 0 scbus9 target 0 lun 0
  da0: <Generic- USB3.0 CRW-CF/MD 1.00> Removable Direct Access SPC-2 SCSI device
  da0: 400.000MB/s transfers
  da0: Attempt to query device size failed: NOT READY, Medium not present
  da0: quirks=0x2<NO_6_BYTE>
  da1 at umass-sim0 bus 0 scbus9 target 0 lun 1
  da1: <Generic- USB3.0 CRW-SM/xD 1.00> Removable Direct Access SPC-2 SCSI device
  da1: 400.000MB/s transfers
  da1: Attempt to query device size failed: NOT READY, Medium not present
  da1: quirks=0x2<NO_6_BYTE>
  da2 at umass-sim0 bus 0 scbus9 target 0 lun 2
  da2: <Generic- USB3.0 CRW-SD 1.00> Removable Direct Access SPC-2 SCSI device
  da2: 400.000MB/s transfers
  da2: Attempt to query device size failed: NOT READY, Medium not present
  da2: quirks=0x2<NO_6_BYTE>
  da3 at umass-sim0 bus 0 scbus9 target 0 lun 3
  da3: <Generic- USB3.0 CRW-MS 1.00> Removable Direct Access SPC-2 SCSI device
  da3: 400.000MB/s transfers
  da3: Attempt to query device size failed: NOT READY, Medium not present
  da3: quirks=0x2<NO_6_BYTE>
  da4 at umass-sim0 bus 0 scbus9 target 0 lun 4
  da4: <Generic- USB3.0 CRW-SD/MS 1.00> Removable Direct Access SPC-2 SCSI device
  da4: 400.000MB/s transfers
  da4: Attempt to query device size failed: NOT READY, Medium not present
  da4: quirks=0x2<NO_6_BYTE>

-- John
Comment 1 john 2019-03-18 03:34:47 UTC
Created attachment 202946 [details]
Patch for crash

Here's what seems to be happening ...

  1) bd_init calls bd_int13probe which creates entries for the various
     drives, including the card reader.  Unfortunately bd_sectorsize
     is set to zero for the card reader (presumably because no media
     is present).

  2) zfs_dev_init calls i386_zfs_probe which uses zfs_probe_dev to
     probe all the drives.

  3) zfs_probe_dev -> open -> disk_open -> ptable_open -> ptable_iso9660read
     at which point things go splat due to cdb2devb attempting to divide
     by the sector size (which is zero).

Fixed by having disk_open check for a sector size of zero.
Comment 2 commit-hook freebsd_committer freebsd_triage 2019-05-05 06:39:11 UTC
A commit references this bug:

Author: tsoome
Date: Sun May  5 06:38:48 UTC 2019
New revision: 347142
URL: https://svnweb.freebsd.org/changeset/base/347142

Log:
  loader: validate sectorsize argument in disk_open()

  The bug and patch is reported against 11.2, but it is good idea to have
  the check in place for all versions.

  PR:		236585
  Submitted by:	john@feith.com
  Reported by:	john@feith.com
  MFC after:	1 day

Changes:
  head/stand/common/disk.c
Comment 3 commit-hook freebsd_committer freebsd_triage 2019-05-06 08:33:43 UTC
A commit references this bug:

Author: tsoome
Date: Mon May  6 08:32:50 UTC 2019
New revision: 347179
URL: https://svnweb.freebsd.org/changeset/base/347179

Log:
  MFC r347142:

  loader: validate sectorsize argument in disk_open()

  The bug and patch is reported against 11.2, but it is good idea to have
  the check in place for all versions.

  PR:		236585
  Submitted by:	john@feith.com
  Reported by:	john@feith.com

Changes:
_U  stable/12/
  stable/12/stand/common/disk.c
Comment 4 commit-hook freebsd_committer freebsd_triage 2019-05-06 08:56:09 UTC
A commit references this bug:

Author: tsoome
Date: Mon May  6 08:55:23 UTC 2019
New revision: 347182
URL: https://svnweb.freebsd.org/changeset/base/347182

Log:
  MFC r347142:

  loader: validate sectorsize argument in disk_open()

  The bug and patch is reported against 11.2, but it is good idea to have
  the check in place for all versions.

  PR:		236585
  Submitted by:	john@feith.com
  Reported by:	john@feith.com

Changes:
_U  stable/11/
  stable/11/stand/common/disk.c