I patched the 2.2.12 kernel to be able to write to the file system within my
driver.
I do this by patching the copy_to/from_user functions like this
if (access_ok(VERIFY_READ, from, n))
__constant_copy_user_zeroing(to,from,n);
else
{
memcpy(to, from, n);
return 0;
}
return n;
this runs, I wrote to an ext2 file and to /dev/ttyS0, but this also have side
effects. The read functionality seems to to work.
I tried to write from a user program to a file using an uninitialised pointer
as write buffer.
The write function returns without error and the file I wrote contains some
binary data, which is the kernels code at the position the pointer refers to.
Second test I made was writing to an address which was not present in kernel
space in the form of
write(fd, (char*)~0, 10);
and get an
general protection fault
So what I need is an function which checks if the access to the addresses
within the kernel are ok like the access_ok which does this for the user space,
so the copy_to/from_user
functions can look like this
if (access_ok(VERIFY_READ, from, n))
__constant_copy_user_zeroing(to,from,n);
else if( kernel_access_ok(VERIFY_READ, from, n) )
{
memcpy(to, from, n);
return 0;
}
return n;
If someone has written such a function, or knows which already implemented
function of Linux does that, please inform me.
TIA
Vasili Goutas
--
Vasilios Goutas
Software-Development
RATIO Entwicklungen GmbH
Phone:+49-(0)40-369007-0 Admiralitätstr. 59
Fax:+49-(0)40-369007-25 20459 Hamburg
Email: mailto:vgo@ratio.de
-
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/