public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: daw@taverner.cs.berkeley.edu (David Wagner)
To: linux-kernel@vger.kernel.org
Subject: Re: Why system call need to copy the date from the userspace before  using it
Date: Sat, 16 Apr 2005 23:46:39 +0000 (UTC)	[thread overview]
Message-ID: <d3s84v$j64$2@abraham.cs.berkeley.edu> (raw)
In-Reply-To: 200504160450.j3G4oqC9029496@hacksaw.org

Hacksaw  wrote:
>What I would expect the kernel to do is this:
>
>system_call_data_prep (userdata, size){	 [...]
>      for each page from userdata to userdata+size
>      {
> 	if the page is swapped out, swap it in
>	if the page is not owned by the user process, return -ENOWAYMAN
>	otherwise, lock the page
>      }   [...]

One challenge that might make this issue a little tricky is that
you have to handle double-indirection, where the kernel copies in
a buffer that includes a pointer to some other buffer that you then
have to copy in.  I think this comes up in some of the ioctl() calls.
Because only the guts of the ioctl() implementation knows the format of
the data structure, only it knows what system_call_data_prep() calls
would be needed.  So, everywhere that currently does copy_from_user()
would have to do system_call_data_prep().  (It wouldn't be sufficient
to call system_call_data_prep() once in some standardized way at the
start of each system call, and leave it at that.)

  parent reply	other threads:[~2005-04-16 23:48 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-13  4:21 Why system call need to copy the date from the userspace before using it 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
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 [this message]
  -- strict thread matches above, loose matches on Subject: below --
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='d3s84v$j64$2@abraham.cs.berkeley.edu' \
    --to=daw@taverner.cs.berkeley.edu \
    --cc=daw-usenet@taverner.cs.berkeley.edu \
    --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