When Device Drivers Go Awry: How They Can Corrupt Memory

August 2nd, 2007

Device drivers act as translators between the different software applications or the operating systems and the device itself. The code, considered to be of higher level, may be encoded independently depending on the particular hardware it may be trying to control. For example, if you’re trying to print a file, the driver will convert the high-level codes to low-level ones, which the printer can understand.

Sometimes, though, device errors may occur. One of its adverse effects is the corruption of the system memory.

Problems in the DMA

DMA (direct memory access) is a typical feature of the more recently released PCs. It permits for particular subsystems of the hardware to gain access into the memory of the system for writing or reading.

A faulty device driver can initiate a wrongful DMA transfer along the bus. This kind of transmission of data can result to the corruption of the system memory. A couple of host bus bridges give you input/output memory management (IMMOU) which permits you to map within the address space of the bus a DMA region going to your system’s memory.

Through this, the bus driver can offer protection to the system’s memory, which is not being utilized for DMA buffers, from possible corruption due to wrongful DMA transfer. The bus driver, however, shouldn’t use the static 1-to-1 mapping, which is from the memory into the bus space, so it can handle DMA transfers. Rather, it should handle dynamic IOMMU mappings. The dma_alloc technique maps to the bus space a memory region, which enables the transfer of DMA. Meanwhile, the dma_free technique considers the mapping invalid, which will then disable DMA towards the memory region. Note, though, that a defective device can still cause DMA buffer corruption being handled by another driver.

Problems in Memory Access and Allocations

Sometimes drivers produce errors due to memory allocation or access. These errors may cause the corruption of the system memory, which may later result to system crash. The usual errors are the following:

1.memory underruns (attempt to access even before the allocated memory starts)
2.memory overruns (attempt to access over the allocated memory’s end)
3.attempt to access system memory that was already freed

Knowing how your driver works, including how it can corrupt memory, can provide you the initial steps to PC troubleshooting, especially in the cases of system crashes.

Entry Filed under: Device Drivers

Leave a Comment

Required

Required, hidden

*

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed


Subscribe to www.DeviceDriverFinder.com

Subscribe to the latest device & driver news!

Reviews

Useful Driver Tools

Categories

Recent Posts

Recent Comments