Messages in this thread | ![/](/images/icornerl.gif) | | Date | Fri, 23 Jul 1999 21:51:15 +0200 (CEST) | From | Ingo Molnar <> | Subject | Re: 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/
| ![\](/images/icornerr.gif) |