Re: bug in write(2) system call.

Horst von Brand (vonbrand@inf.utfsm.cl)
Tue, 20 Oct 1998 16:15:23 -0300


Chris Wedgwood <chris@cybernet.co.nz> said:

[...]

> Basically... if you pass bogus addresses and pointers to the kernel,
> depending on what OS and version you are running, you might get an
> EFAULT and you might not.

This is (somewhat) OK.

> There is no wrong or right way - and no simple fix other than DON'T
> PASS BOGUS POINTERS TO THE KERNEL.

You should try not to, but the kernel _can't_ just believe in your
guarantees. For all it knows, you might be Kubys ;-)

> In linux 2.0.x and more traditional kernels, the verify_area checks
> will determine the address of bogus before reading or writing any
> data, under 2.1.x and I think also NetBSD, if the start of the memory
> range you spcific is legitimate, some data will be read and written.

In the 2.1.xx kernels this mechanism was replaced by a nifty, no-overhead
use of the MM to do the same thing: No checks, but if an illegal access is
attempted, the kernel gets an exception. Look at your nearest Documentation
directory.

-- 
Dr. Horst H. von Brand                       mailto:vonbrand@inf.utfsm.cl
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513

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