[lkml]   [2004]   [Dec]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] kill access_ok() call from copy_siginfo_to_user() that we might as well avoid.


In kernel/signal.c::copy_siginfo_to_user() we are calling access_ok()
unconditionally. As I see it there's no need for this since we might as
well just call copy_to_user() instead of __copy_to_user() later on and
then only get the overhead of the access_ok() check (inside
copy_to_user()) when the if (from->si_code < 0) branch is actually taken.
In the case where the branch is taken the cost is the same, but when the
branch is not taken this patch will save us an access_ok() call.

Comments are always welcome.

Signed-off-by: Jesper Juhl <>

diff -up linux-2.6.10-rc3-bk13-orig/kernel/signal.c linux-2.6.10-rc3-bk13/kernel/signal.c
--- linux-2.6.10-rc3-bk13-orig/kernel/signal.c 2004-12-06 22:24:56.000000000 +0100
+++ linux-2.6.10-rc3-bk13/kernel/signal.c 2004-12-21 00:23:46.000000000 +0100
@@ -2070,10 +2070,8 @@ int copy_siginfo_to_user(siginfo_t __use
int err;

- if (!access_ok (VERIFY_WRITE, to, sizeof(siginfo_t)))
- return -EFAULT;
if (from->si_code < 0)
- return __copy_to_user(to, from, sizeof(siginfo_t))
+ return copy_to_user(to, from, sizeof(siginfo_t))
? -EFAULT : 0;
* If you change siginfo_t structure, please be sure

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 14:08    [W:0.051 / U:2.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site