Ignore:
Timestamp:
Apr 8, 2017, 12:26:55 AM (8 years ago)
Author:
Ben Rietbroek
Message:

Prevent LVM CRC-check indicating OK on zero sectors [v1.1.1-testing]

When 'LVM_InitCRCTable' is not called yet, an LVM CRC-check on a sector
with all zeros would indicate a valid LVM CRC. Eventhough this is not
the case _after_ 'LVM_InitCRCTable' has been called, we rule out this
situation to guard agains coding bugs.

CAUTION:
This is a testbuild !
AirBoot uses the BIOS to access disks and a small coding error can trash
partition tables or other vital disk structures. You are advised to make
backups of TRACK0 and EBRs before using this testbuild. More info at:
https://rousseaux.github.io/netlabs.air-boot/pdf/AirBoot-v1.1.0-manual.pdf

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bootcode/special/lvm.asm

    r100 r101  
    112112;       Out: Carry set, if LVM CRC valid
    113113; Destroyed: None
    114 LVM_CheckSectorCRC              Proc Near   Uses ax dx
    115         call    LVM_GetSectorCRC
     114LVM_CheckSectorCRC              Proc Near   Uses ax bx dx
     115        mov     bx, si
     116        call    IsSectorZero                ; Zero sector implies bad CRC
     117        jz      LVMCSCRC_BadCRC
     118        call    LVM_GetSectorCRC            ; Only use after CRC table is valid
    116119        cmp     ax, word ptr [si+LocLVM_CRC]
    117120        jne     LVMCSCRC_BadCRC
    118121        cmp     dx, word ptr [si+LocLVM_CRC+2]
    119122        jne     LVMCSCRC_BadCRC
    120         stc
     123        stc                                 ; Indicate CRC is OK
    121124        ret
    122125    LVMCSCRC_BadCRC:
    123         clc
     126        clc                                 ; Indicate BAD CRC
    124127        ret
    125128LVM_CheckSectorCRC              EndP
Note: See TracChangeset for help on using the changeset viewer.