lkml.org 
[lkml]   [1999]   [Jul]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Strangest bug
On Fri, Jul 23, 1999 at 03:36:56PM -0400, Stanislav Krasilovskiy wrote:
> Description of the problem: A process passes a pointer allocated in the
> user space to the kernel through a custom system call. This pointer is
> then saved for future reference.
>
> Upon an interrupt, a kernel routine uses this saved pointer with
> copy_from_user() to obtain a copy of that structure. The problem is,
> every now and then the values in the structure are bogus!
>
> This is not due to memory corruption (in the user process, I
> continuously print out the values, and they are fine). When I use
> mlock() on the structure, then the problem no longer occurs (the copy
> reflects accurate values). So the problem has something to do with
> virtual addressing and paging...

You are very close to an explanation with your observation that no porblems
occur with mlock(). mlock() does prevent paging out of the memory.
When the page is paged out and you want to write to it in interrupt context,
it won't work: You are not able to page it in. mlock() is the right solution
to prevent it.

--
Kurt Garloff <garloff@suse.de> SuSE GmbH, Nürnberg, FRG
Linux kernel development; SCSI drivers: tmscsim(DC390), DC395
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 13:53    [W:0.059 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site