From: Andi Kleen <ak@muc.de>
To: Manfred Spraul <manfred@colorfullife.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] add likely around access_ok for uaccess
Date: Sun, 14 Sep 2003 18:49:08 +0200 [thread overview]
Message-ID: <m3znh7xqm3.fsf@averell.firstfloor.org> (raw)
In-Reply-To: <vD5l.6Wt.19@gated-at.bofh.it> (Manfred Spraul's message of "Sun, 14 Sep 2003 13:20:15 +0200")
Manfred Spraul <manfred@colorfullife.com> writes:
> The attached patch adds likely to the tests - any objections? What
> about the archs except i386?
I fixed x86-64 get/put_user, although it doesn't matter much there because
it compiles with -fno-reorder-blocks by default.
(generates smaller code and makes the assembly output much more readable)
But:
>
> --
> Manfred
> --- 2.6/include/asm-i386/uaccess.h 2003-09-12 21:53:58.000000000 +0200
> +++ build-2.6/include/asm-i386/uaccess.h 2003-09-14 12:56:19.000000000 +0200
> @@ -300,7 +300,7 @@
> long __pu_err = -EFAULT; \
> __typeof__(*(ptr)) *__pu_addr = (ptr); \
> might_sleep(); \
> - if (access_ok(VERIFY_WRITE,__pu_addr,size)) \
> + if (likely(access_ok(VERIFY_WRITE,__pu_addr,size))) \
> __put_user_size((x),__pu_addr,(size),__pu_err,-EFAULT); \
> __pu_err; \
> })
> @@ -510,7 +510,7 @@
> direct_copy_to_user(void __user *to, const void *from, unsigned long n)
My copy of 2.6.0test5 doesn't have a "direct_copy_to_user", so I'm wondering
at what tree you're looking.
And more importantly I think the i386 uaccess.h copy_{from/to}_user should
be fixed to not do the access_ok()/memset check inline. It can be as well done
out of line. This would likely save some code size. Doing it inline
just doesn't make any sense.
[x86-64 does it this way]
-Andi
next parent reply other threads:[~2003-09-14 16:49 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <vD5l.6Wt.19@gated-at.bofh.it>
2003-09-14 16:49 ` Andi Kleen [this message]
2003-09-14 11:17 [PATCH] add likely around access_ok for uaccess Manfred Spraul
2003-09-14 19:30 ` Andrew Morton
2003-09-14 19:45 ` Manfred Spraul
2003-09-14 19:48 ` Manfred Spraul
2003-09-14 20:00 ` Andrew Morton
2003-09-15 22:59 ` David S. Miller
2003-09-16 19:49 ` Pavel Machek
2003-09-16 20:55 ` Jeff Garzik
2003-09-16 20:59 ` Pavel Machek
2003-09-17 16:57 ` Manfred Spraul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m3znh7xqm3.fsf@averell.firstfloor.org \
--to=ak@muc.de \
--cc=linux-kernel@vger.kernel.org \
--cc=manfred@colorfullife.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox