public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Why system call need to copy the date from the userspace before using it
@ 2005-04-13  4:21 Tomko
  2005-04-13  5:30 ` Vadim Lobanov
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Tomko @ 2005-04-13  4:21 UTC (permalink / raw)
  To: linux-kernel

Hi all,

I am new to linux , hope someone can help me.
While i am reading the source code of the linux system call , i find 
that the system call need to call copy_from_user() to copy the data from 
user space to kernel space before using it . Why not use it directly as 
the system call has got the address ?  Furthermore , how to distinguish 
between user space and kernel space ?

Thx a lot,

TOM

^ permalink raw reply	[flat|nested] 19+ messages in thread
* RE: Why system call need to copy the date from the userspace before using it
@ 2005-04-13  6:48 Vadim Lobanov
  0 siblings, 0 replies; 19+ messages in thread
From: Vadim Lobanov @ 2005-04-13  6:48 UTC (permalink / raw)
  To: Eshwar; +Cc: 'Tomko', linux-kernel

On Wed, 13 Apr 2005, Eshwar wrote:

>
> >The quick and simple answer to this question is: data integrity.
>
> >The main thing to understand is that, from the perspective of the
> >kernel, any user input provided in the form of system calls must have
> >immutable data. Only if the data is immutable can the kernel code parse
> >it and decide what to do, without getting into really hairy race
> >conditions. And, for that matter, it's much simpler and less error-prone
> >to program code where you don't have to worry about the inputs changing
> >around you all the time.
>
> Does this approach lead to major performance bottleneck??
>

It should not be so much of a performance bottleneck -- this kind of
operation lends itself naturally to parallelization, since it has few
(if any) dependencies. The only race I can think of off-hand is the
exit() syscall, but I'm sure that's already handled elsewhere (just not
sure of the details) In the end, however, if you believe my previous
email, then you should believe that the copy has to happen in any case.

I don't have any actual data points on-hand. Perhaps someone else does?

-Vadim Lobanov

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2005-04-16 23:48 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
  -- strict thread matches above, loose matches on Subject: below --
2005-04-13  6:48 Vadim Lobanov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox