Re: [2/6] uaccess: add probe_kernel_write()

From: Linus Torvalds
Date: Sun Feb 10 2008 - 14:13:29 EST




On Sun, 10 Feb 2008, Jan Kiszka wrote:
>
> Along Linus' suggestion to work on larger chunks in kgdb, here are
> improved probe_kernel_read/write helpers that take a size argument.

I don't think this is good.

Make it
- a function, not a #define
- preferably uninlined (this does *not* look performance-critical)
- get rid of the get_fs/set_fs/set_fs dance

The last point is somewhat debatable, but the fact is, those functions are
not defined to be safe to be called from interrupt context. And since we
use the "__copy_xxxx()" functions with two underscores, those really are
supposed to mean that we've checked the address earlier.

So it's possible that some architecture does need the explicit segment
munging (S390 comes to mind), but in that case, we really should add
special support for that, or we should really validate that get_fs/set_fs
are safe in all contexts.

And regardless, if we *do* end up needing to munge some segment register
(which on other architectures tends to be an address space identifier, not
a segment, but whatever), that just makes it even more clear that this
isn't some macro or inline function, because those things tend to explode
the code-space.

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