Subject: kern/16294: sys___getcwd problem
To: None <gnats-bugs@gnats.netbsd.org>
From: None <Mihai.Chelaru@ballantines.acasa.ro>
List: netbsd-bugs
Date: 04/10/2002 23:29:06
>Number:         16294
>Category:       kern
>Synopsis:       sys___getcwd may be used only in userland
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Apr 10 13:29:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Mihai Chelaru
>Release:        NetBSD 1.5ZC
>Organization:
	
	RomTeleNet
>Environment:
	
	
System: NetBSD ballantines.acasa.ro 1.5ZC NetBSD 1.5ZC (Kefren) #0: Wed Apr 10 23:07:37 EEST 2002 kefren@ballantines.acasa.ro:/usr/src/sys/arch/i386/compile/Kefren i386
Architecture: i386
Machine: i386
>Description:
	
	sys___getcwd may be used only from userland. kernel modules cannot access it because of the copyout function used inside it (that always returns EFAULT). 
>How-To-Repeat:
	
>Fix:
	
	Apply the following patch:

	--- kern/vfs_getcwd.c    Wed Apr 10 23:19:57 2002
	+++ kern/vfs_getcwd.c    Wed Apr 10 23:20:40 2002
	@@ -597,7 +597,8 @@
	lenused = bend - bp;
	*retval = lenused;
	/* put the result into user buffer */
	-       error = copyout(bp, SCARG(uap, bufp), lenused);
	+       error = 0;
	+       bcopy (bp, SCARG(uap, bufp), lenused);

	 out:
		free(path, M_TEMP);


>Release-Note:
>Audit-Trail:
>Unformatted: