November 13th, 2004

belize

Whoa, freaky....

A ghost in a TV commercial... (link)
"If you turn up the sound, you can also hear whispering. The ad was never put on TV because the unexplained ghostly phenomenon frightened the production team out of their wits. Watch it and about halfway through (after the car comes from behind the trees) look closely and you will see the white mist coming up from behind the car and then following it along the road!"
Check out the video:

http://www.westcoastpirate.com/downloads/carghostclassic.mpg
belize

open source, closed specs

The MegaRAID driver is open source, but its ioctl interface at the source level only really supports:

-- querying number of adapters
-- querying driver version
-- querying logical drives per adapter

Pretty much useless.

Everything else seems to be passed through black-box from the userspace ioctl right to the card, then the response from the card copied right back to userspace.

So with an open source driver (mostly useless, but it got me this far), closed specs, and closed management utilities, what's next?

I've added printks where ioctls come in, so I can run the closed-source management utilities and see what they're sending. (and receiving, but I haven't done that yet)

strace only gives:

ioctl(0x3, 0xc06e6d00, 0x80ea780) = 0
ioctl(0x3, 0xc06e6d00, 0x80ea780) = 0
ioctl(0x3, 0xc06e6d00, 0x80ea780) = 0
ioctl(0x3, 0xc06e6d00, 0x80ea780) = 0
ioctl(0x3, 0xc06e6d00, 0x80ea780) = 0
ioctl(0x3, 0xc06e6d00, 0x80ea780) = 0

And I'd dump those 0x80ea780 addresses under gdb, except you can't strace something under gdb, and running it under gdb changes the addresses it uses (presumably).

Maybe I could look at /proc/`pidof megamgr.bin`/mem while stracing it? Hadn't thought of that until just now. But the timing's the hard part. The ioctl struct is read/write, so I want to see it both before the kernel messes with it, and after.

So back to my (ugly) kernel hacking. I've got my changes to build now (into *.o files) but I'm trying to figure out how kbuild makes the *.ko files.
belize

and we have lift-off

Shortly after my first OOPs, I now have my first useful (to me only) kernel modification:

Now when I do a megaraid ioctl (be it from an open source or closed-source utility),

sammy:/usr/src/linux-2.6# ./megadm.pl
Number of adapters: 0 but true

Then dmesg shows what the ioctl was:

megaraid cmm: 2.20.2.0 (Release Date: Thu Aug 19 09:58:33 EDT 2004) (BF modified)
megaraid: 2.20.4.0 (Release Date: Mon Sep 27 22:15:07 EDT 2004)
BF: mega ioctl in: in=0 out=0 op=130 subop=109 adapno=0 buf=0 len=0
dump: [00 00 00 00 00 00 00 00 ffffff82 6d 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 30 16 08 00 00 00 00 ]