copyin

willcox%mycroft at gswd-vms.arpa willcox%mycroft at gswd-vms.arpa
Thu Mar 12 00:47:44 AEST 1987


I don't think that Ron Natalie has it quite right about where you can
or must use copin/out.

 1) No version of copyin/out that I've seen will work for other than
    the current process.  In other words, you can't use it from
    interrupt code, nor to copy data to/from another process.

 2) On lots of machines, the current process is mapped while you are
    processing a system call.  However, one of the jobs of copyin/out
    even on these systems is to ensure that the user has legal access
    to the area of memory in question.  They prevent the kernel from
    getting a segmentation fault and from copying over its own area
    when the user gives it a bogus pointer.  For this reason, you MUST
    (a moral, if not physical requirement) use copyin/out (or fuword,
    uiomove on BSD, etc.) to access user space.  If you have a case
    where you are sure that you can blindly use a pointer supplied from
    user space, then I can write a program that will crash your system.

David A. Willcox
Gould CSD-Urbana
1101 E. University Ave.
Urbana, IL 61801
217-384-8500
UUCP: {decvax,ihnp4}!uiucdcs!ccvaxa!willcox
ARPA: willcox at gswd-vms.arpa



More information about the Comp.unix.wizards mailing list