Skip to content
  • Philippe Mathieu-Daudé's avatar
    defac5e2
    hw/block/fdc: Prevent end-of-track overrun (CVE-2021-3507) · defac5e2
    Philippe Mathieu-Daudé authored
    
    
    Per the 82078 datasheet, if the end-of-track (EOT byte in
    the FIFO) is more than the number of sectors per side, the
    command is terminated unsuccessfully:
    
    * 5.2.5 DATA TRANSFER TERMINATION
    
      The 82078 supports terminal count explicitly through
      the TC pin and implicitly through the underrun/over-
      run and end-of-track (EOT) functions. For full sector
      transfers, the EOT parameter can define the last
      sector to be transferred in a single or multisector
      transfer. If the last sector to be transferred is a par-
      tial sector, the host can stop transferring the data in
      mid-sector, and the 82078 will continue to complete
      the sector as if a hardware TC was received. The
      only difference between these implicit functions and
      TC is that they return "abnormal termination" result
      status. Such status indications can be ignored if they
      were expected.
    
    * 6.1.3 READ TRACK
    
      This command terminates when the EOT specified
      number of sectors have been read. If the 82078
      does not find an I D Address Mark on the diskette
      after the second· occurrence of a pulse on the
      INDX# pin, then it sets the IC code in Status Regis-
      ter 0 to "01" (Abnormal termination), sets the MA bit
      in Status Register 1 to "1", and terminates the com-
      mand.
    
    * 6.1.6 VERIFY
    
      Refer to Table 6-6 and Table 6-7 for information
      concerning the values of MT and EC versus SC and
      EOT value.
    
    * Table 6·6. Result Phase Table
    
    * Table 6-7. Verify Command Result Phase Table
    
    Fix by aborting the transfer when EOT > # Sectors Per Side.
    
    Cc: qemu-stable@nongnu.org
    Cc: Hervé Poussineau <hpoussin@reactos.org>
    Fixes: baca51fa ("floppy driver: disk geometry auto detect")
    Reported-by: default avatarAlexander Bulekov <alxndr@bu.edu>
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/339
    
    
    Signed-off-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
    Message-Id: <20211118115733.4038610-2-philmd@redhat.com>
    Reviewed-by: default avatarHanna Reitz <hreitz@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
    defac5e2
    hw/block/fdc: Prevent end-of-track overrun (CVE-2021-3507)
    Philippe Mathieu-Daudé authored
    
    
    Per the 82078 datasheet, if the end-of-track (EOT byte in
    the FIFO) is more than the number of sectors per side, the
    command is terminated unsuccessfully:
    
    * 5.2.5 DATA TRANSFER TERMINATION
    
      The 82078 supports terminal count explicitly through
      the TC pin and implicitly through the underrun/over-
      run and end-of-track (EOT) functions. For full sector
      transfers, the EOT parameter can define the last
      sector to be transferred in a single or multisector
      transfer. If the last sector to be transferred is a par-
      tial sector, the host can stop transferring the data in
      mid-sector, and the 82078 will continue to complete
      the sector as if a hardware TC was received. The
      only difference between these implicit functions and
      TC is that they return "abnormal termination" result
      status. Such status indications can be ignored if they
      were expected.
    
    * 6.1.3 READ TRACK
    
      This command terminates when the EOT specified
      number of sectors have been read. If the 82078
      does not find an I D Address Mark on the diskette
      after the second· occurrence of a pulse on the
      INDX# pin, then it sets the IC code in Status Regis-
      ter 0 to "01" (Abnormal termination), sets the MA bit
      in Status Register 1 to "1", and terminates the com-
      mand.
    
    * 6.1.6 VERIFY
    
      Refer to Table 6-6 and Table 6-7 for information
      concerning the values of MT and EC versus SC and
      EOT value.
    
    * Table 6·6. Result Phase Table
    
    * Table 6-7. Verify Command Result Phase Table
    
    Fix by aborting the transfer when EOT > # Sectors Per Side.
    
    Cc: qemu-stable@nongnu.org
    Cc: Hervé Poussineau <hpoussin@reactos.org>
    Fixes: baca51fa ("floppy driver: disk geometry auto detect")
    Reported-by: default avatarAlexander Bulekov <alxndr@bu.edu>
    Resolves: https://gitlab.com/qemu-project/qemu/-/issues/339
    
    
    Signed-off-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
    Message-Id: <20211118115733.4038610-2-philmd@redhat.com>
    Reviewed-by: default avatarHanna Reitz <hreitz@redhat.com>
    Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
Loading