copyin (4.3BSD)

chris at mimsy.UUCP chris at mimsy.UUCP
Wed Mar 11 04:12:59 AEST 1987


In article <4838 at brl-adm.ARPA> Conley%csvax.cs.ukans.edu at RELAY.CS.NET writes:
>Well, a couple of us here have been mucking with a system call ...
>one parameter is a string, and we use uap->string just like any other string
>(e.g. in a tprintf). However, an associate insists that this cannot be
>done, i.e. the string exists in user space (and this is kernel mode, hence
>kernel address space).

He is right.  However, user space and kernel space are not mutually
exclusive, not on a Vax.  Kernel code can look in user space if it
wants to.  If, however, the `string' is a wild pointer, the machine
will crash:

	main()
	{
		new_syscall((char *) 0xc0000000);
		/* NOTREACHED */
	}

>"Gotta do a copyin".

Not necessarily.  The routine for dealing with C strings in user
space is `copyinstr', but some other part of the kernel may be
doing that already (e.g., namei).
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690)
UUCP:	seismo!mimsy!chris	ARPA/CSNet:	chris at mimsy.umd.edu



More information about the Comp.unix.wizards mailing list