read PCI memory and config spyce through /dev/mem

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Mon May 6 11:19:07 EDT 2013


On Mon, 06 May 2013 14:44:03 -0000, "Warlich, Christof" said:

> $ dd if=/dev/mem bs=1 count=1024 skip=4150263808
> dd: reading `/dev/mem': Bad address
> 0+0 records in
> 0+0 records out
> 0 bytes (0 B) copied, 6.6658e-05 s, 0.0 kB/s
>
> The kernel config help says that _PCI_ memory access is even
> possible with STRICT_DEVMEM enabled. Can anyone give me a hint
> what I may do wrong?

You *do* realize that doing a byte access on a 64-bit PCI register
will probably fail, right?  And changing it to bs=8 won't fix it either,
because some registers are 32-bit, and some are write-only.

Bottom line - what you're doing wrong is not accessing the PCI address
space in the exact manner that the PCI spec requires.  You're lucky it
just threw "bad address" - it *is* possible to end up wiping your entire
system this way if you screw up the PCI config for your disk controller or
similar.  Be glad you didn't have to recover from your backups this time.

You *do* have backups, right?

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 865 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130506/9fcaf7aa/attachment.bin 


More information about the Kernelnewbies mailing list