Hello,

I am not sure if this should go into tech@ since I cannot work out a
decent fix for this yet, but atactl secerase has a potentially
dangerous 1000mS timeout set.

Potentially dangerous, because this timeout results in some
misinformation being provided to the caller or user:

# atactl wd1 secerase user
User password:
wd1 (pciide1:1:0): timeout
        type: ata
        c_bcount: 512
        c_skip: 0
atactl: ATA command timed out
wd1: flush cache command timeout
#

The HDD light remains solid ON for a long period of time, suggesting
the erase is continuing despite the command returning early, with error.

I was fortunate to be able to recover the current 160GB drive by using
atactl secunlock and atactl secdisable. My 80GB test drive, as it
seems, wasn't so lucky.

I have found part of the problem in src/sbin/atactl/atactl.c in the
device_sec_erase() function:

...
        req.command = ATA_SEC_ERASE_UNIT;
        req.timeout = 1000;
        req.flags = ATACMD_WRITE;
        req.databuf = (caddr_t)&pwd;
        req.datalen = sizeof(pwd);
...

req.timeout = 1000;

One problem is I don't know what this value should be, to provide no
timeout.

Given that a SECURITY ERASE UNIT command may not return until several
minutes, or even hours, depending on how long the actual erase is, and
given the potential to brick a drive, it seems that the timeout here
does more harm than good.


Running -current (cvs update performed 7/6/15; built 7/6/15).
I have not modified any source files from the originals.

This is a long-running regression; I have tested this back to
5.5-release, although in earlier releases, I noticed it seems to
"cancel" the erase once the timeout is up.


=================================
OpenBSD 5.7-current (GENERIC.MP) #0: Sun Jun  7 17:53:51 UTC 2015
    r...@m.my.domain:/usr/src/sys/arch/amd64/compile/GENERIC.MP
real mem = 2120744960 (2022MB)
avail mem = 2052657152 (1957MB)
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: SMBIOS rev. 2.4 @ 0xdc010 (36 entries)
bios0: vendor LENOVO version "2OKT48AUS" date 11/13/2008
bios0: LENOVO 8982A48
acpi0 at bios0: rev 0
acpi0: sleep states S0 S1 S3 S4 S5
acpi0: tables DSDT FACP TCPA MCFG APIC BOOT SSDT
acpi0: wakeup devices EXP1(S4) EXP2(S4) PCIB(S5) KBC0(S4) MSE0(S4)
    COMA(S5) AC97(S1) PWRB(S3) USB1(S3) USB2(S3) USB3(S3) USB4(S3)
    EUSB(S3) acpitimer0 at acpi0: 3579545 Hz, 24 bits acpimcfg0 at
    acpi0 addr 0xe0000000, bus 0-9 acpimadt0 at acpi0 addr 0xfee00000:
    PC-AT compat cpu0 at mainbus0: apid 0 (boot processor)
cpu0: Intel(R) Pentium(R) Dual CPU E2140 @ 1.60GHz, 1596.26 MHz
cpu0:
    
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,DTES64,MWAIT,DS-CPL,EST,TM2,SSSE3,CX16,xTPR,PDCM,NXE,LONG,LAHF,PERF,SENSOR
    cpu0: 1MB 64b/line 4-way L2 cache cpu0: smt 0, core 0, package 0
mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
cpu0: apic clock running at 199MHz
cpu0: mwait min=64, max=64, C-substates=0.2.2, IBE
cpu1 at mainbus0: apid 1 (application processor)
cpu1: Intel(R) Pentium(R) Dual CPU E2140 @ 1.60GHz, 1596.00 MHz
cpu1:
    
FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,SSE3,DTES64,MWAIT,DS-CPL,EST,TM2,SSSE3,CX16,xTPR,PDCM,NXE,LONG,LAHF,PERF,SENSOR
    cpu1: 1MB 64b/line 4-way L2 cache cpu1: smt 0, core 1, package 0
ioapic0 at mainbus0: apid 2 pa 0xfec00000, version 20, 24 pins
acpiprt0 at acpi0: bus 0 (PCI0)
acpiprt1 at acpi0: bus 1 (PEG_)
acpiprt2 at acpi0: bus 2 (EXP1)
acpiprt3 at acpi0: bus 4 (EXP2)
acpiprt4 at acpi0: bus 10 (PCIB)
acpicpu0 at acpi0: PSS
acpicpu1 at acpi0: PSS
acpibtn0 at acpi0: PWRB
cpu0: Enhanced SpeedStep 1596 MHz: speeds: 800, 600 MHz
pci0 at mainbus0 bus 0
pchb0 at pci0 dev 0 function 0 "Intel 82946GZ Host" rev 0x02
ppb0 at pci0 dev 1 function 0 "Intel 82946GZ PCIE" rev 0x02: msi
pci1 at ppb0 bus 1
vga1 at pci0 dev 2 function 0 "Intel 82946GZ Video" rev 0x02
intagp0 at vga1
agp0 at intagp0: aperture at 0xc0000000, size 0x10000000
inteldrm0 at vga1
drm0 at inteldrm0
inteldrm0: 1024x768
wsdisplay0 at vga1 mux 1: console (std, vt100 emulation)
wsdisplay0: screen 1-5 added (std, vt100 emulation)
azalia0 at pci0 dev 27 function 0 "Intel 82801GB HD Audio" rev 0x01: msi
azalia0: codecs: Analog Devices/0x1986
audio0 at azalia0
ppb1 at pci0 dev 28 function 0 "Intel 82801GB PCIE" rev 0x01: msi
pci2 at ppb1 bus 2
ppb2 at pci0 dev 28 function 1 "Intel 82801GB PCIE" rev 0x01: msi
pci3 at ppb2 bus 4
bge0 at pci3 dev 0 function 0 "Broadcom BCM5786" rev 0x02, BCM5754/5787
    A2 (0xb002): msi, address 00:01:6c:9d:47:eb brgphy0 at bge0 phy 1:
    BCM5787 10/100/1000baseT PHY, rev. 0 uhci0 at pci0 dev 29 function
    0 "Intel 82801GB USB" rev 0x01: apic 2 int 23 uhci1 at pci0 dev 29
    function 1 "Intel 82801GB USB" rev 0x01: apic 2 int 19 uhci2 at
    pci0 dev 29 function 2 "Intel 82801GB USB" rev 0x01: apic 2 int 18
    uhci3 at pci0 dev 29 function 3 "Intel 82801GB USB" rev 0x01: apic
    2 int 16 ehci0 at pci0 dev 29 function 7 "Intel 82801GB USB" rev
    0x01: apic 2 int 23 usb0 at ehci0: USB revision 2.0 uhub0 at usb0
    "Intel EHCI root hub" rev 2.00/1.00 addr 1 ppb3 at pci0 dev 30
    function 0 "Intel 82801BA Hub-to-PCI" rev 0xe1 pci4 at ppb3 bus 10
pcib0 at pci0 dev 31 function 0 "Intel 82801GB LPC" rev 0x01
pciide0 at pci0 dev 31 function 1 "Intel 82801GB IDE" rev 0x01: DMA,
    channel 0 configured to compatibility, channel 1 configured to
    compatibility atapiscsi0 at pciide0 channel 0 drive 0 scsibus1 at
    atapiscsi0: 2 targets cd0 at scsibus1 targ 0 lun 0: <HL-DT-ST,
    DVD-RAM GSA-H40N, RX04> ATAPI 5/cdrom removable cd0(pciide0:0:0):
    using PIO mode 4, Ultra-DMA mode 2 pciide0: channel 1 disabled (no
    drives) pciide1 at pci0 dev 31 function 2 "Intel 82801GB SATA" rev
    0x01: DMA, channel 0 configured to native-PCI, channel 1 configured
    to native-PCI pciide1: using apic 2 int 19 for native-PCI interrupt
    wd0 at pciide1 channel 0 drive 0: <ST3160815AS> wd0: 16-sector PIO,
    LBA48, 152627MB, 312581808 sectors wd0(pciide1:0:0): using PIO mode
    4, Ultra-DMA mode 5 wd1 at pciide1 channel 1 drive 0: <WDC
    WD1600AAJS-08L7A0> wd1: 16-sector PIO, LBA48, 152627MB, 312581808
    sectors wd1(pciide1:1:0): using PIO mode 4, Ultra-DMA mode 5
ichiic0 at pci0 dev 31 function 3 "Intel 82801GB SMBus" rev 0x01: apic
    2 int 19 iic0 at ichiic0
spdmem0 at iic0 addr 0x50: 1GB DDR2 SDRAM non-parity PC2-5300CL5
spdmem1 at iic0 addr 0x52: 1GB DDR2 SDRAM non-parity PC2-6400CL5
usb1 at uhci0: USB revision 1.0
uhub1 at usb1 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb2 at uhci1: USB revision 1.0
uhub2 at usb2 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb3 at uhci2: USB revision 1.0
uhub3 at usb3 "Intel UHCI root hub" rev 1.00/1.00 addr 1
usb4 at uhci3: USB revision 1.0
uhub4 at usb4 "Intel UHCI root hub" rev 1.00/1.00 addr 1
isa0 at pcib0
isadma0 at isa0
fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
pckbc0 at isa0 port 0x60/5 irq 1 irq 12
pcppi0 at isa0 port 0x61
spkr0 at pcppi0
lpt0 at isa0 port 0x378/4 irq 7
it0 at isa0 port 0x2e/2: IT8718F rev 2, EC port 0x290
uhidev0 at uhub1 port 2 configuration 1 interface 0 "Dell Dell USB
    Keyboard" rev 1.10/3.07 addr 2 uhidev0: iclass 3/1
ukbd0 at uhidev0: 8 variable keys, 6 key codes
wskbd0 at ukbd0: console keyboard, using wsdisplay0
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
root on wd0a (79b0df1416ed5d94.a) swap on wd0b dump on wd0b
wd1(pciide1:1:0): timeout
        type: ata
        c_bcount: 512
        c_skip: 0
wd1: flush cache command timeout

Reply via email to