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, 23 Jul 1999, Stanislav Krasilovskiy wrote:

> Upon an interrupt, a kernel routine uses this saved pointer with
> copy_from_user() to obtain a copy of that structure. [...]

this is a big no-no! Only kernel-space addresses (pointers) are guaranteed
to be preserved during context switches, user-space changes all the time.
The interrupt is not guaranteed to happen in the context of the 'relevant'
process - it will happen whenever the hardware generates it and in the
context of whatever process is running at that moment.

> every now and then the values in the structure are bogus!

yes, because occasionally the system is executing another process (or the
idle thread), in which context that user-space pointer makes no sense.

the solution: copy the data into kernel-space, then use this kernel-space
data from interrupts.

-- mingo


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

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