From: "Robert P. J. Day" <rpjday@mindspring.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: why "probe_kernel_address()", not "probe_user_address()"?
Date: Sat, 28 Oct 2006 12:52:13 -0400 (EDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0610281246160.2537@localhost.localdomain> (raw)
In-Reply-To: <20061028092906.6c1562e3.akpm@osdl.org>
On Sat, 28 Oct 2006, Andrew Morton wrote:
> On Sat, 28 Oct 2006 11:56:24 -0400 (EDT)
> "Robert P. J. Day" <rpjday@mindspring.com> wrote:
>
> >
> > it seems odd that the purpose of the "probe_kernel_address()" macro
> > is, in fact, to probe a *user* address (from linux/uaccess.h):
> >
> > #define probe_kernel_address(addr, retval) \
> > ({ \
> > long ret; \
> > \
> > inc_preempt_count(); \
> > ret = __get_user(retval, addr); \
> > dec_preempt_count(); \
> > ret; \
> > })
> >
> > given that that routine is referenced only 5 places in the
> > entire source tree, wouldn't it be more meaningful to use a more
> > appropriate name?
>
> You'll notice that all callers are indeed probing kernel addresses.
> The function _could_ be used for user addresses and could perhaps be
> called probe_address().
>
> One of the reasons this wrapper exists is to communicate that the
> __get_user() it is in fact not being used to access user memory.
um ... ok. i think. i agree that "probe_address()" would be a more
appropriate name, but i'm still a bit confused as to why
"__get_user()" would be used to access something *not* in user memory,
given this seemingly unambiguous explanation in
include/asm-i386/uaccess.h:
=====
* get_user: - Get a simple variable from user space.
* @x: Variable to store result.
* @ptr: Source address, in user space.
*
* Context: User context only. This function may sleep.
*
* This macro copies a single simple variable from user space to kernel
* space. It supports simple types like char and int, but not larger
* data types like structures or arrays.
...
=====
so having probe_kernel_address() invoke __get_user() does seem to be
just a wee bit confusing for us newbies. in any event, i'll leave the
clarification for someone much higher up the food chain.
rday
next prev parent reply other threads:[~2006-10-28 16:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-28 15:56 Robert P. J. Day
2006-10-28 16:29 ` Andrew Morton
2006-10-28 16:52 ` Robert P. J. Day [this message]
2006-10-28 17:02 ` Robert P. J. Day
2006-10-28 20:30 ` Luca Tettamanti
2006-10-28 21:01 ` Robert P. J. Day
2006-10-29 15:49 ` Luca Tettamanti
2006-10-29 13:02 ` Denis Vlasenko
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=Pine.LNX.4.64.0610281246160.2537@localhost.localdomain \
--to=rpjday@mindspring.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®