lkml.org 
[lkml]   [1997]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: MMU protected kernel stacks [was: Re: Kernel stack corruption with SCSI]

> > AHA2940 driver hangs in the init phase. Without having looked into the
> > SCSI code i bet the problem is that the driver allocates some (small)
> > control structure on the stack, and uses virt_to_bus(stackaddr) to set up
> > DMA, which looses badly with vmalloc()-ed memory.
>
> yup, this was the problem, the following code solved it:

argh it doesnt solve it ... [silly me].

Is there any easy way to do this?

the only way i can think of is hacking virt_to_* to detect such MMU kernel
stack areas and doing the translation correctly.

the current translation [for i386 and the Sun4c] is something like this:

#define virt_to_bus(virt_addr) (virt_addr - PAGE_OFFSET)

Which isnt correct if the 'virtual' address is some random MMU mapped
page outside of the almost 1:1 linear mapped kernel virtual memory.

something like this could be done:

if (virt_addr-PAGE_OFFSET < mem_size)
return virt_addr-PAGE_OFFSET;
else
{
/* do complete page-table lookup address translation */
}

sigh.

-- mingo


\
 
 \ /
  Last update: 2005-03-22 13:38    [W:0.031 / U:0.880 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site