mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russell King <rmk@arm.linux.org.uk>
To: Jeff Dike <jdike@karaya.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: copy_to_user to a kmapped address
Date: Mon, 26 Aug 2002 21:33:04 +0100	[thread overview]
Message-ID: <20020826213304.I4763@flint.arm.linux.org.uk> (raw)
In-Reply-To: <200208262119.QAA03617@ccure.karaya.com>; from jdike@karaya.com on Mon, Aug 26, 2002 at 04:19:37PM -0500

On Mon, Aug 26, 2002 at 04:19:37PM -0500, Jeff Dike wrote:
> Is this (in file_read_actor) bogus or am I missing something?
> 
> 1621            kaddr = kmap(page);
> 1622            left = __copy_to_user(desc->buf, kaddr + offset, size);
> 1623            kunmap(page);
> 
> It seems to me that copy_to_user should be able to assume that the destination
> address is a user address.
> 
> This is biting me because I'm moving the UML kernel into a separate address
> space, so there's no way, in general, to tell the difference between a kernel
> address and a userspace address.

Umm, that's copying from kaddr + offset _to_ desc->buf.  desc->buf
should be the user space address, and kaddr + offset a kernel address:

unsigned long __copy_to_user(void *to, const void *from, unsigned long n)

-- 
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html


  reply	other threads:[~2002-08-26 20:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-26 21:19 Jeff Dike
2002-08-26 20:33 ` Russell King [this message]
2002-08-26 22:31   ` Jeff Dike

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=20020826213304.I4763@flint.arm.linux.org.uk \
    --to=rmk@arm.linux.org.uk \
    --cc=jdike@karaya.com \
    --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®