Index of /PowerState
Name Last modified Size
Parent Directory -
Makefile 2013-03-10 00:39 43
ReadMe.txt 2013-03-10 13:58 1.7K
output-ahci.txt 2013-03-10 00:39 13K
output-sata_sil24.txt 2013-03-10 00:39 13K
checkstate.c 2013-03-10 00:39 13K
output-highpoint.txt 2013-03-10 00:39 25K
HDIO_DRIVE_CMD Check Power Mode behaviour
I was seeing odd results with the HighPoint driver when the Check Power
Mode operation was performed. In order to provide some evidence that the
call was overwriting data beyond the buffer length, and that it wasn't
actually working, I wrote a program to perform the necessary operations.
Essentially, I'm doing:
buffer initialised to known state
command = ATA Check Power Mode (0xe5)
nsectors = 0
feature = 0
sector = 0
ioctl(fd, HDIO_DRIVE_CMD, buffer)
check that we were successful, report if not
check that no data beyond the first 4 bytes were corrupted.
And then repeating for 'nsectors=1', which also shouldn't corrupt things.
My findings are that the highpoint driver /is/ misbehaving in the first
case. It populates 512 bytes after the 4 bytes, AND fails the operation
as well - not only is it overrunning the buffer, it's not working either.
The secondary test, of what happens if nsectors=1, reports success, but
doesn't report a reliable result. It /also/ fails on other drivers - writing
what appears to be garbage into the buffer, but could actually be a data
leak. I'm not sure and I've not investigated far enough.
The source files are provided here:
These build the test code. Run it to see what you get, and compare
the output between drivers.
The output from the test for the 3 drivers I had in my system.
Both ahci and sata_sil24 appear to report garbage in the sectors=1
The Highpoint driver fails the sectors=0 case, and reports garbage
in the sectors=1 case.