Re: [PATCH/2.4]: do_write_mem() return value check
From: Marcelo Tosatti
Date: Thu Mar 25 2004 - 22:33:03 EST
On Wed, Mar 24, 2004 at 07:59:01PM +0100, BlaisorBlade wrote:
> From: Andrew Morton, and me (I did a first fix for 2.6 and sent to him, he
> checked everything and committed it and I changed the trivial bits for 2.4).
> - remove unused `file *' arg from do_write_mem()
> - Add checking for copy_from_user() failures in do_write_mem()
> (Note: /dev/kmem can be written to only by root, so this *cannot* have
> security implications)
> - Return correct value from kmem writes() when a fault is encountered. A
> write()-style syscall's return values are:
> 0 when nothing was written and there was no error (someone tried to
> write zero bytes)
> >0: the number of bytes copied, whether or not there was an error.
> Userspace detects errors by noting that the write() return value is less
> than was requested.
> <0: there was an error and no bytes were copied
> TODO: Do the same changes for read_mem() and read_kmem(). The code is more
> messy so I must create do_read_mem() to avoid clumsy counting; I will post the
> patch first for 2.6.
This is nice -- although I see it as a 2.6 cleanup only.
Do you actually have any practical problem caused by the current broken
"always return -EFAULT" ?
Otherwise leave it for 2.6.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/