mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "David Schwartz" <davids@webmaster.com>
To: "Catalin Marinas" <catalin.marinas@arm.com>
Cc: "linux kernel mailing list" <linux-kernel@vger.kernel.org>
Subject: RE: Why system call need to copy the date from the userspace before using it
Date: Wed, 13 Apr 2005 19:18:03 -0700	[thread overview]
Message-ID: <MDEHLPKNGKAHNMBLJOLKAEHODCAB.davids@webmaster.com> (raw)
In-Reply-To: <425DD105.7010304@haha.com>


> Catalin Marinas wrote:

> >Tomko <tomko@haha.com> wrote:

> >>Inside the system call , the kernel often copy the data by calling
> >>copy_from_user() rather than just using strcpy(), is it because the
> >>memory mapping in kenel space is different from user space?

> >No, it is because this function checks whether the access to the user
> >space address is OK. There are situations when it can also sleep (page
> >not present).

> what u means "OK"?  kernel space should have right to access any memory
> address , can u expained in details what u means "OK"?

	Kernel space does have the right to access any memory but user space
doesn't, so the kernel can't just take an address from user space and use
it. Consider:

int i=open("/dev/null", O_RDWR);
write(i, NULL, 4);

	Are you seriously suggesting the kernel should just read from address zero
because a user-space program asked it to?

	DS



  reply	other threads:[~2005-04-14  2:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-13  4:21 Tomko
2005-04-13  5:30 ` Vadim Lobanov
2005-04-13 10:29 ` Jan-Benedict Glaw
2005-04-13 10:43   ` Tomko
2005-04-13 11:10     ` Catalin Marinas
2005-04-14  2:10       ` Tomko
2005-04-14  2:18         ` David Schwartz [this message]
2005-04-14 14:05         ` Helge Hafting
2005-04-13 11:33 ` Benjamin Herrenschmidt
2005-04-13 11:59   ` Hacksaw
2005-04-13 12:40     ` Richard B. Johnson
2005-04-13 18:37       ` Theodore Ts'o
2005-04-13 19:20         ` Richard B. Johnson
2005-04-16  4:50           ` Hacksaw
2005-04-16  5:18             ` Vadim Lobanov
2005-04-16  8:30               ` Hacksaw
2005-04-16 19:35                 ` Vadim Lobanov
2005-04-16 23:46             ` David Wagner
2005-04-13  6:48 Vadim Lobanov

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=MDEHLPKNGKAHNMBLJOLKAEHODCAB.davids@webmaster.com \
    --to=davids@webmaster.com \
    --cc=catalin.marinas@arm.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®