Re: Strangest bug

Kurt Garloff (garloff@suse.de)
Fri, 23 Jul 1999 22:10:24 +0200


--i9LlY+UWpKt15+FH
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable

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.
>=20
> 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!
>=20
> 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.

--=20
Kurt Garloff <garloff@suse.de> SuSE GmbH, N=FCrnberg, FRG
Linux kernel development; SCSI drivers: tmscsim(DC390), DC395

--i9LlY+UWpKt15+FH
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3in

iQCVAwUBN5jMMBaQN/7O/JIVAQF3GAQAj/hsiYfd6undvyUHxve5B7EWviSOvUx6
roROa3GPCQCM+Ud1tKfhtHG+1G7eTZGUMxco5XIgWer02wTeuTio0pCxlFe/lt3z
3Pw1kzh7mQncRPVBY2RmQy/KfOJTbYQ9vlfiEDC9rZXg74z1sT+PV9t9o+X5hl3Q
5jJPAWWfw7I=
=8zXn
-----END PGP SIGNATURE-----

--i9LlY+UWpKt15+FH--

-
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/