Skip to contentSkip to conversation

Why system call need to copy the date from the userspace before using it

DISCUSSION Vadim Lobanov 1 participant 1 message Apr 13, 2005

lore
Share & tools
lore
#0 lore raw
Quoted 11 lines · Eshwar
Quoted 10 lines

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.

Quoted 2 lines

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