Possible fake host protected area (hpa) detected in ide drive causing SectorIdNotFound

Bug #26119 reported by Jorge Juan
28
Affects Status Importance Assigned to Milestone
linux (Ubuntu)
Fix Released
Undecided
Unassigned
linux-source-2.6.15 (Ubuntu)
Won't Fix
Medium
Ben Collins
linux-source-2.6.22 (Ubuntu)
Won't Fix
Low
Unassigned

Bug Description

In two PC's ide drives (home and work) it happens that (full details are attached):

1) 2.6.12 (also 2.6.8, 2.6.10) kernel detects a host protected area of just one
sector: reported native capacity is only one sector more than reported current
capacity. Host protected area is disabled and current capacity is set to native
capacity.

2) later during boot, last drive's sector is seeked giving SectorIdNotFound for
several times.

3) DMA is disable in the whole IDE channel

4) seek ends with "end_request: I/O error"

* Faulty sector is the additional sector detected in native capacity.
* Further access using "dd" gives the same error.
* DMA can be enabled afterwords and system runs OK since partitions does not
reach the last sector.

After looking at the kernel code (ide-disk.c, etc.), it seems that checking the
host protected area consists on checking the hpa flag on the disk and comparing
the current capacity with that directly obtained from the disk. However, I don't
see how to query the native capacity with hdparm, since the only value it gives
correspondes to the initial current capacity. Kernel hacking is not among my skills.

I was not able to find a way to say to the kernel to stay with the current
capacity (and do not disable hpa). A related option (hdX=stroke) seems to have
been droped.

I was not able to pass options to the ide modules through kernel boot parameter.
I seems to work now, but the only way I know is using hd=C,H,S not the number of
sectors.

I was not able to disable the hpa flag in the drive. Can it be done with Linux?

Would be useful a kernel parameter saying not to disable hpa (e.g. hdX=hpa_enable)?
Would be useful a kernel parameter to specify the size in lba sectors (e.g.
hdX_sectors=NNNN)?

I include a report about on of the failing disks.

====================================
GENERAL INFO
====================================

$ uname -a
Linux valhalla 2.6.12-9-686 #1 Mon Oct 10 13:25:32 BST 2005 i686 GNU/Linux

Ubuntu 5.10 Breezy
# dpkg --list
...
ii linux-image-2.6.12-9-686 2.6.12-9.23
...

Same thing happen after upgrading to:

ii linux-image-2.6.12-10-686 2.6.12-10.24

====================================
KERNEL LOG
====================================

Nov 22 18:09:48 valhalla kernel: [4294670.701000] VP_IDE: IDE controller at PCI
slot 0000:00:07.1
Nov 22 18:09:48 valhalla kernel: [4294670.701000] PCI: Via IRQ fixup for
0000:00:07.1, from 255 to 0
Nov 22 18:09:48 valhalla kernel: [4294670.701000] VP_IDE: chipset revision 6
Nov 22 18:09:48 valhalla kernel: [4294670.701000] VP_IDE: not 100%% native mode:
will probe irqs later
Nov 22 18:09:48 valhalla kernel: [4294670.702000] VP_IDE: VIA vt82c686b (rev 41)
IDE UDMA100 controller on pci0000:00:07.1
Nov 22 18:09:48 valhalla kernel: [4294670.702000] ide0: BM-DMA at
0xc000-0xc007, BIOS settings: hda:DMA, hdb:pio
Nov 22 18:09:48 valhalla kernel: [4294670.702000] ide1: BM-DMA at
0xc008-0xc00f, BIOS settings: hdc:DMA, hdd:DMA
Nov 22 18:09:48 valhalla kernel: [4294670.702000] Probing IDE interface ide0...
Nov 22 18:09:48 valhalla kernel: [4294671.086000] hda: ST320414A, ATA DISK drive
Nov 22 18:09:48 valhalla kernel: [4294671.698000] ide0 at 0x1f0-0x1f7,0x3f6 on
irq 14
Nov 22 18:09:48 valhalla kernel: [4294671.698000] Probing IDE interface ide1...
Nov 22 18:09:48 valhalla kernel: [4294672.082000] hdc: ST340823A, ATA DISK drive
Nov 22 18:09:48 valhalla kernel: [4294672.796000] hdd: LG DVD-ROM DRD-8120B,
ATAPI CD/DVD-ROM drive
Nov 22 18:09:48 valhalla kernel: [4294672.847000] ide1 at 0x170-0x177,0x376 on
irq 15
Nov 22 18:09:48 valhalla kernel: [4294672.847000] Probing IDE interface ide2...
Nov 22 18:09:48 valhalla kernel: [4294673.360000] Probing IDE interface ide3...
Nov 22 18:09:48 valhalla kernel: [4294673.872000] Probing IDE interface ide4...
Nov 22 18:09:48 valhalla kernel: [4294674.384000] Probing IDE interface ide5...
Nov 22 18:09:48 valhalla kernel: [4294674.904000] hda: max request size: 128KiB
Nov 22 18:09:48 valhalla kernel: [4294674.904000] hda: 39102336 sectors (20020
MB) w/2048KiB Cache, CHS=38792/16/63, UDMA(100)
Nov 22 18:09:48 valhalla kernel: [4294674.904000] hda: cache flushes not supported
Nov 22 18:09:48 valhalla kernel: [4294674.904000]
/dev/ide/host0/bus0/target0/lun0: p1 p2 p3
Nov 22 18:09:48 valhalla kernel: [4294674.917000] hdc: max request size: 128KiB
Nov 22 18:09:48 valhalla kernel: [4294674.918000] hdc: Host Protected Area detected.
Nov 22 18:09:48 valhalla kernel: [4294674.918000] ^Icurrent capacity is 78165360
sectors (40020 MB)
Nov 22 18:09:48 valhalla kernel: [4294674.918000] ^Inative capacity is 78165361
sectors (40020 MB)
Nov 22 18:09:48 valhalla kernel: [4294674.918000] hdc: Host Protected Area disabled.
Nov 22 18:09:48 valhalla kernel: [4294674.918000] hdc: 78165361 sectors (40020
MB) w/1024KiB Cache, CHS=65535/16/63, UDMA(100)
Nov 22 18:09:48 valhalla kernel: [4294674.918000] hdc: cache flushes not supported
Nov 22 18:09:48 valhalla kernel: [4294674.918000]
/dev/ide/host0/bus1/target0/lun0: p1
Nov 22 18:09:48 valhalla kernel: [4294674.959000] hdd: ATAPI 40X DVD-ROM drive,
512kB Cache
Nov 22 18:09:48 valhalla kernel: [4294674.959000] Uniform CD-ROM driver
Revision: 3.20

... (snip) ...

Nov 22 18:09:48 valhalla kernel: [4294702.618000] device-mapper: 4.4.0-ioctl
(2005-01-12) initialised: <email address hidden>
Nov 22 18:09:48 valhalla kernel: [4294703.492000] cdrom: open failed.
Nov 22 18:09:48 valhalla kernel: [4294704.159000] cdrom: open failed.
Nov 22 18:09:48 valhalla kernel: [4294704.337000] hdc: dma_intr: status=0x51 {
DriveReady SeekComplete Error }
Nov 22 18:09:48 valhalla kernel: [4294704.337000] hdc: dma_intr: error=0x10 {
SectorIdNotFound }, LBAsect=78165360, sector=78165360
Nov 22 18:09:48 valhalla kernel: [4294704.337000] ide: failed opcode was: unknown
Nov 22 18:09:48 valhalla kernel: [4294704.479000] hdc: dma_intr: status=0x51 {
DriveReady SeekComplete Error }
Nov 22 18:09:48 valhalla kernel: [4294704.479000] hdc: dma_intr: error=0x10 {
SectorIdNotFound }, LBAsect=78165360, sector=78165360
Nov 22 18:09:48 valhalla kernel: [4294704.479000] ide: failed opcode was: unknown
Nov 22 18:09:48 valhalla kernel: [4294704.621000] hdc: dma_intr: status=0x51 {
DriveReady SeekComplete Error }
Nov 22 18:09:48 valhalla kernel: [4294704.621000] hdc: dma_intr: error=0x10 {
SectorIdNotFound }, LBAsect=78165360, sector=78165360
Nov 22 18:09:48 valhalla kernel: [4294704.621000] ide: failed opcode was: unknown
Nov 22 18:09:48 valhalla kernel: [4294704.763000] hdc: dma_intr: status=0x51 {
DriveReady SeekComplete Error }
Nov 22 18:09:48 valhalla kernel: [4294704.763000] hdc: dma_intr: error=0x10 {
SectorIdNotFound }, LBAsect=78165360, sector=78165360
Nov 22 18:09:48 valhalla kernel: [4294704.763000] ide: failed opcode was: unknown
Nov 22 18:09:48 valhalla kernel: [4294704.763000] hdc: DMA disabled
Nov 22 18:09:48 valhalla kernel: [4294704.763000] hdd: DMA disabled
Nov 22 18:09:48 valhalla kernel: [4294704.913000] ide1: reset: success
Nov 22 18:09:48 valhalla kernel: [4294705.085000] hdc: task_in_intr: status=0x59
{ DriveReady SeekComplete DataRequest Error }
Nov 22 18:09:48 valhalla kernel: [4294705.085000] hdc: task_in_intr: error=0x10
{ SectorIdNotFound }, LBAsect=78230639, sector=78165360
Nov 22 18:09:48 valhalla kernel: [4294705.085000] ide: failed opcode was: unknown
Nov 22 18:09:48 valhalla kernel: [4294705.258000] hdc: task_in_intr: status=0x59
{ DriveReady SeekComplete DataRequest Error }
Nov 22 18:09:48 valhalla kernel: [4294705.258000] hdc: task_in_intr: error=0x10
{ SectorIdNotFound }, LBAsect=78230639, sector=78165360
Nov 22 18:09:48 valhalla kernel: [4294705.258000] ide: failed opcode was: unknown
Nov 22 18:09:48 valhalla kernel: [4294705.432000] hdc: task_in_intr: status=0x59
{ DriveReady SeekComplete DataRequest Error }
Nov 22 18:09:48 valhalla kernel: [4294705.432000] hdc: task_in_intr: error=0x10
{ SectorIdNotFound }, LBAsect=78230639, sector=78165360
Nov 22 18:09:48 valhalla kernel: [4294705.432000] ide: failed opcode was: unknown
Nov 22 18:09:48 valhalla kernel: [4294705.605000] hdc: task_in_intr: status=0x59
{ DriveReady SeekComplete DataRequest Error }
Nov 22 18:09:48 valhalla kernel: [4294705.605000] hdc: task_in_intr: error=0x10
{ SectorIdNotFound }, LBAsect=78230639, sector=78165360
Nov 22 18:09:48 valhalla kernel: [4294705.605000] ide: failed opcode was: unknown
Nov 22 18:09:48 valhalla kernel: [4294705.755000] ide1: reset: success
Nov 22 18:09:48 valhalla kernel: [4294705.928000] hdc: task_in_intr: status=0x59
{ DriveReady SeekComplete DataRequest Error }
Nov 22 18:09:48 valhalla kernel: [4294705.928000] hdc: task_in_intr: error=0x10
{ SectorIdNotFound }, LBAsect=78230639, sector=78165360
Nov 22 18:09:48 valhalla kernel: [4294705.928000] ide: failed opcode was: unknown
Nov 22 18:09:48 valhalla kernel: [4294705.928000] end_request: I/O error, dev
hdc, sector 78165360

... (snip) ...

====================================
HDPARM
====================================

# hdparm -Iv /dev/hdc

/dev/hdc:
 multcount = 0 (off)
 IO_support = 0 (default 16-bit)
 unmaskirq = 0 (off)
 using_dma = 0 (off)
 keepsettings = 0 (off)
 readonly = 0 (off)
 readahead = 256 (on)
 geometry = 65535/16/63, sectors = 78165361, start = 0

ATA device, with non-removable media
        Model Number: ST340823A
        Serial Number: 7EF16KS0
        Firmware Revision: 3.05
Standards:
        Supported: 4 3 2 1
        Likely used: 6
Configuration:
        Logical max current
        cylinders 16383 16383
        heads 16 16
        sectors/track 63 63
        --
        CHS current addressable sectors: 16514064
        LBA user addressable sectors: 78165360
        device size with M = 1024*1024: 38166 MBytes
        device size with M = 1000*1000: 40020 MBytes (40 GB)
Capabilities:
        LBA, IORDY(can be disabled)
        Buffer size: 1024.0kB Queue depth: 1
        Standby timer values: spec'd by Standard
        R/W multiple sector transfer: Max = 16 Current = ?
        Recommended acoustic management value: 128, current value: 0
        DMA: mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 *udma5
             Cycle time: min=120ns recommended=120ns
        PIO: pio0 pio1 pio2 pio3 pio4
             Cycle time: no flow control=240ns IORDY flow control=120ns
Commands/features:
        Enabled Supported:
           * READ BUFFER cmd
           * WRITE BUFFER cmd
           * Host Protected Area feature set
           * Look-ahead
           * Write cache
           * Power Management feature set
                Security Mode feature set
           * SMART feature set
                Automatic Acoustic Management feature set
           * SET MAX security extension
           * DOWNLOAD MICROCODE cmd
Security:
        Master password revision code = 65534
                supported
        not enabled
        not locked
        not frozen
        not expired: security count
        not supported: enhanced erase
HW reset results:
        CBLID- above Vih
        Device num = 1
Checksum: correct

# hdparm -iv /dev/hdc

/dev/hdc:
 multcount = 0 (off)
 IO_support = 0 (default 16-bit)
 unmaskirq = 0 (off)
 using_dma = 0 (off)
 keepsettings = 0 (off)
 readonly = 0 (off)
 readahead = 256 (on)
 geometry = 65535/16/63, sectors = 78165361, start = 0

 Model=ST340823A, FwRev=3.05, SerialNo=7EF16KS0
 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=0
 BuffType=unknown, BuffSize=1024kB, MaxMultSect=16, MultSect=off
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=78165360
 IORDY=on/off, tPIO={min:240,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes: pio0 pio1 pio2 pio3 pio4
 DMA modes: mdma0 mdma1 mdma2
 UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5
 AdvancedPM=no WriteCache=enabled
 Drive conforms to: device does not report version: 1 2 3 4

 * signifies the current active mode

========================================
fdisk
========================================

# LANG=C fdisk -l /dev/hdc

Disk /dev/hdc: 40.0 GB, 40020664832 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot Start End Blocks Id System
/dev/hdc1 * 1 4865 39078081 83 Linux

# LANG=C fdisk -lu /dev/hdc

Disk /dev/hdc: 40.0 GB, 40020664832 bytes
255 heads, 63 sectors/track, 4865 cylinders, total 78165361 sectors
Units = sectors of 1 * 512 = 512 bytes

   Device Boot Start End Blocks Id System
/dev/hdc1 * 63 78156224 39078081 83 Linux

CVE References

Revision history for this message
Ben Collins (ben-collins) wrote :

If possible, please upgrade to Dapper's 2.6.15-7 kernel. If you do not want to
upgrade to Dapper, then you can also wait for the Dapper Flight 2 CD's, which
are due out within the next few days.

Let me know if this bug still exists with this kernel.

Revision history for this message
Jorge Juan (jjchico) wrote :

I upgraded to dapper this week. The problem is still there in both PC's I have tested. I will attach dmesg output.

Revision history for this message
Jorge Juan (jjchico) wrote : dmesg output

dmesg output for kernel 2.6.15-18 (dapper)

Revision history for this message
Jeff Balderson (jbalders) wrote :

I am having the exact same problems with a bunch of Seagate ST320413A drives. The errors look identical to Jorge's, except my LBA/sectors are reported as:

LBAsect=39167615, sector=39102336

cat /proc/ide/hda/geometry:
physical 16383/16/63
logical 38792/16/63

LBA (from the drive's label) = 39102336 (= 38792*16*63)

I've tested this both with a PC and a Sun Netra X1 (via Sparc port). The drives are the standard drives that came with my Netra X1's. I have some other Netra X1's with ST340016A drives in them that work just fine, and I've tried some IBM drives in my Netras and they work fine too.

I noticed this during an upgrade from Sarge -> Hoary -> Breezy -> Dapper and broke somewhere during the upgrade path. It definitely works fine with Debian Sarge (2.6.8 kernel), probably with Hoary, maybe with Breezy, and definitely not with Dapper. So it would appear that someone "improved" the drive detection logic at some point after that, and that's hosing the works.

This problem also exists using an i386 Dapper beta install CD and a Sparc Dapper 5/18/06 netboot image.

I'm not certain whether any of this info helps, other than to confirm the problem.

Revision history for this message
jhort (maricidfu) wrote :

I have the same problem. I use Ubuntu Dapper with kernel 2.6.15-25-686. My hard disk is a ST340823A. I have the same error than Jorge Juan, in the same sector, 78165360. I think that the error appears in all ST340823A hard disks.

Excuse my poor english.

Revision history for this message
RoMaNSoFt (roman-rs-labs) wrote :

Tested on up-to-date Dapper. Kernel: 2.6.15-26-386. The bug is still there. I observed the very same odd behaviour when I had Fedora so it seems a kernel issue. It's very annoying 'cause DMA is being disabled and performance highly decreases. I have two ST340823A disks and the bug is present in both of them.

-Roman

Revision history for this message
Josep Vicent Sala (jvsala) wrote :

This problem also happens in edgy with a 2.6.17 kernel. I tried upgrading from Dapper to solve the problem but to no avail. The hard disk is a Seagate 40GB model. I had this problem before in Debian Sarge after upgrading from a 2.4 series kernel to a 2.6.15 kernel in Debian. It seems some kind of kernel issue. I've seen in forums similar issues with Fedora distros.

As a workaround I enable dma with hdparm after booting and the performance is good. It only affects the booting process although it is annoying, it adds quite a bit of time to the booting process, specially after the kernel starts trying repetitively to access the "phantom" sector until it disables dma.

Revision history for this message
Frank Kuerten (frank-frank-kuerten) wrote :

I get the same error with a Seagate disk. Someone in a german newsgroup discovered the location in ide-disk.c, where the sector is added. Please take a look at: http://groups.google.com/group/linux.debian.user.german/browse_thread/thread/ab8980cb5ea0a9fb/7f475d3ce8f34211?tvc=2&q=linux+hpa+seagate+0x10

The hpa doesn't really exist. On some disks you have to add one sector, on Seagates probably not. (I don't know what the correct behaviour is, concerning to ATA)

Revision history for this message
RoMaNSoFt (roman-rs-labs) wrote : Re: [Bug 26119] Re: Possible fake host protected area (hpa) detected in ide drive causing SectorIdNotFound

Do you forwarded that thread to someone in charge of current ATA/IDE kernel
code development? I mean, a patch should be reviewed and approved before it
 is ready for production. Did you contact with somebody with the skills and
authority to approve this? Did you send it to lkml? It would be nice if
this nasty bug could be officially resolved...

Frank Kuerten escribió:
> I get the same error with a Seagate disk. Someone in a german newsgroup
> discovered the location in ide-disk.c, where the sector is added. Please
> take a look at:
> http://groups.google.com/group/linux.debian.user.german/browse_thread/thread/ab8980cb5ea0a9fb/7f475d3ce8f34211?tvc=2&q=linux+hpa+seagate+0x10
>
> The hpa doesn't really exist. On some disks you have to add one sector,
> on Seagates probably not. (I don't know what the correct behaviour is,
> concerning to ATA)
>

--

Saludos,
-Roman

PGP Fingerprint:
09BB EFCD 21ED 4E79 25FB 29E1 E47F 8A7D EAD5 6742
[Key ID: 0xEAD56742. Available at KeyServ]

Revision history for this message
Frank Kuerten (frank-frank-kuerten) wrote :

@Roman:
The answers are: no, fullAck, no, no and absolutely!

The longer version: I didn't try the mentioned patch (witch is more a quick hack), because i have two disks, a Seagate with error and a Samsung without ghost-hpa. So the suggested blacklist or whitelist should be implemented. This is far above my skills, i just wanted to connect the threads.
Please could someone help us with telling the right person(s) about this?

Revision history for this message
Jorge Juan (jjchico) wrote : Re: [Bug 26119] Re: Possible fake host protected area (hpa) detected in ide drive causing SectorIdNotFound

It seems clear that querying some disks it gives an extra sector, maybe
a firmware bug, but I did not find any firmware upgrades for my disk nor
any clue on Seagate support pages. Simply decreasing one sector in the
ide_disk.c code that detects hpa solves the problems (I tried) but this
hack would probably not be accepted by the kernel people. Ben Collins is
our best option to push the problem up, but he has more that 20 high
priority kernel bugs to attend. Unfortunately, kernel hacking is far
above my possibilities.

Cheers.

El mié, 10-01-2007 a las 19:08 +0000, Frank Kuerten escribió:
> @Roman:
> The answers are: no, fullAck, no, no and absolutely!
>
> The longer version: I didn't try the mentioned patch (witch is more a quick hack), because i have two disks, a Seagate with error and a Samsung without ghost-hpa. So the suggested blacklist or whitelist should be implemented. This is far above my skills, i just wanted to connect the threads.
> Please could someone help us with telling the right person(s) about this?
>

Revision history for this message
Baczek (imbaczek) wrote :

I've got the same drive and the same problem in edgy. The drive was reclaimed from an older machine.

Revision history for this message
Jeff Balderson (jbalders) wrote :

I confirm that my earlier report about the Sparcs I'm using have the same problem in Edgy too. I reported it in slightly more detail in Bug # 49265

Revision history for this message
Jeff Balderson (jbalders) wrote :

The problem is still occurring in Feisty.

Revision history for this message
Christian Gogolin (cgogolin-deactivatedaccount) wrote :

I have the very same problem under Debian Etch kernel 2.6.18-4-686 with a ST340823A drive.

Thus I think it is a kernel issue.

Revision history for this message
Mikko Rapeli (mikko-rapeli) wrote : Fix available upstream, testing needed

Hello,

I ran into this too with Debian etch ( http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=401035 ), bugged linux-ide people ( http://bugzilla.kernel.org/show_bug.cgi?id=8816 and http://marc.info/?t=118596132600016&r=1&w=2 ) and now a fix is available:

- for 2.6.23-rc1at http://marc.info/?l=linux-ide&m=118609784802744&w=2
- for 2.6.22.1 at http://marc.info/?l=linux-ide&m=118609639204242&w=2

For older distro kernels like 2.6.18-4 from Debian, the 2.6.22.1 patch worked without the EXPORT_SYMBOL_GPL part. Perhaps it could apply to Ubuntu kernels as well.

I only have ST340823A drive available for testing, so other drives having similar problems of 1 sector HPA and size reporting should be verified and included in the blacklist. A good place to report them, I think, is the discussion thread on linux-ide at http://marc.info/?t=118596132600016&r=1&w=2 .

-Mikko

Revision history for this message
Jorge Juan (jjchico) wrote :

Dear Mikko,

as reported in a previous comment to this bug, ST320413A seems to have the same problem. It should be added to the blacklist. Can you comment that on the linux-ide list? I am not a subscriber to linux-ide. Thanks.

jorge.

Revision history for this message
Mikko Rapeli (mikko-rapeli) wrote :

Could you try 2.6.22.1 with the following patch?

Revision history for this message
Jorge Juan (jjchico) wrote : Re: [Bug 26119] Re: Possible fake host protected area (hpa) detected in ide drive causing SectorIdNotFound

I will not have access to these drives until September. I will post
when I have checked.

The patch seems ok.

Thanks.

jorge.

2007/8/8, Mikko Rapeli <email address hidden>:
> Could you try 2.6.22.1 with the following patch?
>
>
> ** Attachment added: "ide_bug_patch_04.txt"
> http://launchpadlibrarian.net/8732416/ide_bug_patch_04.txt
>
> --
> Possible fake host protected area (hpa) detected in ide drive causing SectorIdNotFound
> https://bugs.launchpad.net/bugs/26119
> You received this bug notification because you are a direct subscriber
> of the bug.
>

--
Jorge Juan

Revision history for this message
Jorge Juan (jjchico) wrote :

I will not have access to these drives until September, probably. I will post
when I have checked.

The patch seems ok.

Thanks.

jorge.

Revision history for this message
Jorge Juan (jjchico) wrote :

The patch applies correctly to the 2.6.22.6 kernel and works fine for the ST320413A. I have not tested the other drive yet.
I attach dmesg output.
It is a great work. I hope the patch makes its way to standard kernels soon.

Thanks.

jorge.

Revision history for this message
Josep Vicent Sala (jvsala) wrote :

It seems it is already there and will be available with 2.6.23.

From the 2.6.23-rc4 changelog (http://www.kernel.org/pub/linux/kernel/v2.6/testing/ChangeLog-2.6.23-rc4):

commit b0244a00451c1ad64bf0a51f50679f7146786780
Author: Bartlomiej Zolnierkiewicz <email address hidden>
Date: Mon Aug 20 22:42:57 2007 +0200

    ide-disk: workaround for buggy HPA support on ST340823A (take 3)

    This disk reports total number of sectors instead of maximum sector address
    in response to READ_NATIVE_MAX_ADDRESS command and also happily accepts
    SET_MAX_ADDRESS command with the bogus value. This results in +1 sector
    capacity being used and errors on attempts to use the last sector.

    ...
    hdd: Host Protected Area detected.
    Â Â Â Â current capacity is 78165360 sectors (40020 MB)
    Â    native  capacity is 78165361 sectors (40020 MB)
    hdd: Host Protected Area disabled.
    ...
    hdd: reading: block=78165360, sectors=1, buffer=0xc1e63000
    hdd: dma_intr: status=0x51 { DriveReady SeekComplete Error }
    hdd: dma_intr: error=0x10 { SectorIdNotFound }, LBAsect=78165360, sector=78165360
    ...

    Add hpa_list[] table and workaround the issue in idedisk_check_hpa().

    v2:
    * Add missing export and improve patch description a bit.

    v3:
    * Add list termination. (From Mikko)

    Fixes kernel bugzilla bug #8816.

    Thanks to Mikko for investigating the issue and helping with this patch.

    Cc: Mikko Rapeli <email address hidden>
    Cc: Alan Cox <email address hidden>
    Signed-off-by: Bartlomiej Zolnierkiewicz <email address hidden>

Revision history for this message
Baczek (imbaczek) wrote :

I can confirm that 2.6.23-rc6 + newest libdevmapper fixes the bug for me (Seagate.)

Revision history for this message
Jorge Juan (jjchico) wrote :

Now the problem is solved upstream for ST320413A as well. See http://www.kernel.org/pub/linux/kernel/v2.6/testing/ChangeLog-2.6.23-rc7

We will probably have to wait to Gutsy+1 to see the changes in stock ubuntu kernels.

...
commit 7062cdc5edb3ba4b2eb906684cd19e103de1f920
Author: Jorge Juan Chico <email address hidden>
Date: Mon Sep 17 12:35:30 2007 +0200

    ide: ST320413A has the same problem as ST340823A

    ST320413A has the same problem as ST340823A. Please see
    https://bugs.launchpad.net/ubuntu/+source/linux-source-2.6.15/+bug/26119

    From: "Jorge Juan Chico" <email address hidden>
    Signed-off-by: Bartlomiej Zolnierkiewicz <email address hidden>
...

Revision history for this message
Chuck Short (zulcss) wrote :

I have added this patch for gutsy

Changed in linux-source-2.6.15:
status: Incomplete → In Progress
Revision history for this message
Tim Gardner (timg-tpi) wrote :

Gutsy commit 8ffbba00342b99978db13147ee8dcdfe454405c9
Gutsy commit bd393e276a79f25e92296f26d3da3fe1b9b51fec

Changed in linux-source-2.6.22:
assignee: nobody → timg-tpi
importance: Undecided → Low
status: New → Fix Committed
Revision history for this message
Kyle McMartin (kyle) wrote :
Download full text (5.9 KiB)

linux-source-2.6.22 (2.6.22-13.40) gutsy; urgency=low

  [Amit Kucheria]

  * Enable CONFIG_VM86 for LPIA
    - LP: #146311
  * Update configuration files
  * Disable MSI by default
  * Add mmconf documentation
  * Update configuration files

  [Bartlomiej Zolnierkiewicz]

  * ide-disk: workaround for buggy HPA support on ST340823A (take 3)
    - LP: #26119

  [Ben Collins]

  * ubuntu/cell: Fixup ps3 related modules for d-i, enable RTAS console
  * ubuntu/cell: Enable CELLEB and related modules (pata_scc)
  * ubuntu/cell: Move ps3rom to storage-core. Also use spidernet, not
    spider_net.
  * ubuntu/cell: Set PS3_MANAGER=y
  * ubuntu: Set NR_CPUS=256 for sparc64-smp

  [Chuck Short]

  * [USB] USB] Support for MediaTek MT6227 in cdc-acm.
    - LP: #134123
  * [XEN] Fix xen vif create with more than 14 guests.
    - LP: #14486

  [Jorge Juan Chico]

  * ide: ST320413A has the same problem as ST340823A
    - LP: #26119

  [Kyle McMartin]

  * fix -rt build
  * fix ia32entry-xen.S for CVE-2007-4573
  * fix build when CONFIG_PCI_MSI is not set

  [Matthew Garrett]

  * hostap: send events on data interface as well as master interface
    - LP: #57146
  * A malformed _GTF object should not prevent ATA device recovery
    - LP: #139079
  * hostap: send events on data interface as well as master interface
    - LP: #57146
  * A malformed _GTF object should not prevent ATA device recovery
    - LP: #139079
  * Don't lose appletouch button release events
  * Fix build with appletouch change
  * Disable Thinkpad backlight support on machines with ACPI video
    - LP: #148055
  * Don't attempt to register a callback if there is no CMOS object
    - LP: #145857
  * Update ACPI bay hotswap code to support locking
    - LP: #148219
  * Update ACPI bay hotswap code to support locking
    - LP: #148219
  * Don't attempt to register a callback if there is no CMOS object
    - LP: #145857
  * Disable Thinkpad backlight support on machines with ACPI video
    - LP: #148055

  [Steffen Klassert]

  * 3c59x: fix duplex configuration
    - LP: #94186

  [Thomas Gleixner]

  * clockevents: remove the suspend/resume workaround^Wthinko

  [Tim Gardner]

  * orinoco_cs.ko missing
    - LP: #125832
  * Marvell Technology ethernet card not recognized and not operational
    - LP: #135316
  * Marvell Technology ethernet card not recognized and not operational
    - LP: #135316
  * acpi_scan_rsdp() breaks some PCs by not honouring ACPI specification
    - LP: #144336
  * VIA southbridge Intel id missing
    - LP: #128289
  * Add T-Sinus 111card to hostap_cs driver to be able to upload firmware
    - LP: #132466
  * RTL8111 PCI Express Gigabit driver r8169 big files produce slow file
    transfer
    - LP: #114171
  * Guest OS does not recognize a lun with non zero target id on Vmware ESX
    Server
    - LP: #140761
  * Modualrize vesafb
    - LP: #139505
  * Nikon cameras need support in unusual_devs.h
    - LP: #134477
  * agp for i830m broken in gutsy
    - LP: #139767
  * hdaps: Added support for Thinkpad T61
    - LP: #147383
  * xen: Update config for i386
    - LP: #139047
  * xen: resync for amd64
    - LP: #139047
  * ide-disk: workaround for buggy HPA support ...

Read more...

Changed in linux-source-2.6.22:
status: Fix Committed → Fix Released
Tim Gardner (timg-tpi)
Changed in linux-source-2.6.22:
assignee: timg-tpi → nobody
Revision history for this message
Jorge Juan (jjchico) wrote :
Download full text (6.3 KiB)

Kernel OOPs with 2.6.22-14-generic when using the problematic drives ST320413A and ST340823A. Official kernel 2.6.24-rc1 works fine.

There seems to be a problem with the call to strstr in the black list checking code (dmesg below). I do not know why the same code works fine for 2.6.24-rc1. I include a patch with its description.

Subject: [PATCH] ide: correct hpa blacklist in ide-disk.c to avoid oopses

From: Jorge Juan <email address hidden>

Some drives reporting an extra sector are blacklisted in ide-disk.c, which solved bug 8816
(http://bugzilla.kernel.org/show_bug.cgi?id=8816). However, some systems oopses when checking
the blacklist, like Ubuntu 2.6.22-14 kernels. This patch changes the firmware version from
NULL to "ALL" in the list which solves the problem.

Signed-off-by: Jorge Juan <email address hidden>

---

--- linux-source-2.6.22/drivers/ide/ide-disk.c.orig 2007-11-05 18:20:32.000000000 +0100
+++ linux-source-2.6.22/drivers/ide/ide-disk.c 2007-10-31 17:46:19.000000000 +0100
@@ -488,9 +488,9 @@ static inline int idedisk_supports_lba48
  * maximum sector address. We list them here.
  */
 static const struct drive_list_entry hpa_list[] = {
- { "ST340823A", NULL },
- { "ST320413A", NULL },
- { NULL, NULL }
+ { "ST340823A", "ALL" },
+ { "ST320413A", "ALL" },
+ { NULL, NULL }
 };
 #endif

Relevant dmesg output:

[ 0.000000] Linux version 2.6.22-14-generic (buildd@crested) (gcc version 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)) #1 SMP Sun Oct 14 21:45:15 GMT 2007 (Ubuntu 2.6.22-14.46-generic)
[ 0.000000] Command line: root=UUID=9d3c2aff-a615-4e45-b464-7460ad58439a ro single
...
[ 17.937552] Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
[ 17.937619] ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
[ 17.940072] ALI15X3: IDE controller at PCI slot 0000:00:0e.0
[ 17.940140] ACPI: PCI Interrupt 0000:00:0e.0[A] -> GSI 19 (level, low) -> IRQ 19
[ 17.940254] ALI15X3: chipset revision 199
[ 17.940308] ALI15X3: not 100% native mode: will probe irqs later
[ 17.940376] ide0: BM-DMA at 0xff00-0xff07, BIOS settings: hda:DMA, hdb:pio
[ 17.940516] ide1: BM-DMA at 0xff08-0xff0f, BIOS settings: hdc:DMA, hdd:pio
[ 17.940653] Probing IDE interface ide0...
[ 17.960757] SCSI subsystem initialized
[ 17.965697] libata version 2.21 loaded.
[ 17.976720] usbcore: registered new interface driver usbfs
[ 17.976804] usbcore: registered new interface driver hub
[ 17.976880] usbcore: registered new device driver usb
[ 17.977639] ohci_hcd: 2006 August 04 USB 1.1 'Open' Host Controller (OHCI) Driver
[ 18.053690] Floppy drive(s): fd0 is 1.44M
[ 18.087444] FDC 0 is a post-1991 82077
[ 18.257634] hda: ST320413A, ATA DISK drive
[ 18.933359] hda: selected mode 0x45
[ 18.933675] ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
[ 18.935895] Probing IDE interface ide1...
[ 19.673606] hdc: HL-DT-ST DVDRAM GSA-4167B, ATAPI CD/DVD-ROM drive
[ 20.013336] hdc: selected mode 0x42
[ 20.014152] ide1 at 0x170-0x177,0x376 on irq 15
[ 20.020228] sata_uli 0000:00:0e.1: version 1.2
[ 20.020295] ACPI: PCI Interrupt 0000:00:0e.1[A] ->...

Read more...

Revision history for this message
Jorge Juan (jjchico) wrote :

Looking into the code I think I understand the problem. Code up to 2.6.22 used "ALL" to refer to any firmware version and the checking function ide_in_drive_list() used strstr to check for the firmware version or for "ALL". From 2.6.23 on, any firmware version is noted as a NULL, and newer code in ide_in_drive_list() checks for the NULL before calling strstr. Calling strstr with NULL is unprdictable, thus the oops. The original patch was taken from 2.6.23 and applied to 2.6.22, where the convention was still "ALL" not NULL.

Thus, the patch above that replaces NULL's for "ALL"'s should work (and indeed it works in my case). Newer kernel versions (2.6.23 and above) works correctly.

Please consider applying the patch for a future 2.6.22 revision since it makes the related drives to hang the machine on boot, making the original problem even worst.

Thanks.

Revision history for this message
Jorge Juan (jjchico) wrote :

The fix released does not work. A new patch has been proposed.

Changed in linux-source-2.6.22:
status: Fix Released → In Progress
Revision history for this message
Leann Ogasawara (leannogasawara) wrote :

The Hardy Heron Alpha series was recently released which contains an updated version of the kernel. You can download and try the new Hardy Heron Alpha release from http://cdimage.ubuntu.com/releases/hardy/ . You should be able to then test the new kernel via the LiveCD. If you can, please verify if this bug still exists or not and report back your results. General information regarding the release can also be found here: http://www.ubuntu.com/testing/ . Thanks.

Changed in linux:
status: New → Incomplete
Revision history for this message
Leann Ogasawara (leannogasawara) wrote :

Also please note that this bug will remain open against the actively developed kernel bug against 2.6.22 and 2.6.15 this will be closed. Thanks.

Changed in linux-source-2.6.22:
status: In Progress → Won't Fix
Changed in linux-source-2.6.15:
status: In Progress → Won't Fix
Revision history for this message
Jeff Balderson (jbalders) wrote :

Hardy works for me running a netinstall with kernel 2.6.24-10-sparc64. I'll report back if it doesn't work after the installation is complete.

Revision history for this message
Leann Ogasawara (leannogasawara) wrote :

Thanks Jeff.

Jorge, since you are the original bug reporter, care to comment? Thanks.

Revision history for this message
Jorge Juan (jjchico) wrote :

I have tried amd64 live CD with both ST340823A and ST320413A and they both work OK. The number of sectors reported for both disks is now OK. So the bug can be closed for 2.6.24.

Have you considered applying the patch in https://bugs.launchpad.net/ubuntu/+source/linux/+bug/26119/comments/30 to future 2.6.22 revisions? I think it may worth the while since current ubuntu 2.6.22 kernels crash when using these drives, this kernels have to be maintained for a year and the patch is quite simple that there is little risk it would compromise kernel's stability.

Thanks for your effort.

jorge.

Revision history for this message
Jan Evert van Grootheest (j-e-van-grootheest) wrote :

I'm not so bold as to re-open this bug. But I really want you people to seriously consider my case.

I've got this amd64 box with xen on it (running amd64 arch). The dom0 crashes exactly as Jorge Juan shows above (in https://bugs.launchpad.net/ubuntu/+source/linux/+bug/26119/comments/30).
Up till now there is NO NEWER dom0 kernel so really this is stuck at 2.6.18.

Given that the patch appears to be really small and with a very limited scope I really hope that you reconsider the won't fix status of this bug.

(why do I want to upgrade from 2.6.18? well, there's a SATA controller in there that I'm dying to use and 2.6.18 doesn't handle that very well and I'm hoping that 2.6.22 does much better)

Thanks,
Jan Evert

Changed in linux:
status: Incomplete → Fix Released
Revision history for this message
Gasyalzmn (gasyzmani) wrote :

ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAyeAEbAaXfeUtJl+zB5lZncnHCvxA6c0dJQlqdMoF6kvSayyxAtWgd0gpPpRLwf1/VeXG0SFVrDrsDtmjkM/UU4P3DgzLG0nI0/73ZqZR6WyzqXz+vN676XuvLuDhACAkEPiiwVjkd1WLivV8UAg70OZ0o1EHMfiQ1rmvdON018NhvVeA0D52HCdEzu8ZmSf68PIBrEZAcmp5ncoiuSw8qqaz3QX1eR1MVd0iIMq0OFYCpCJFqz3VDE82RKB79WXm+vNZBUQ9nJi8hJqgMpbvRzijzbQlmDtN4TQ6tUw4aKy7w8oQNjIIQ/UUHG0v18625Fuf/pliD9bOWVj0ZHUXmw== sachin@xpertsachin

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.