Module Name: src Committed By: riastradh Date: Sat Mar 28 16:13:38 UTC 2015
Modified Files: src/sys/kern: subr_copy.c Log Message: Swap kernel/curproc tests in copy*_vmspace so rump can catch EFAULT. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/kern/subr_copy.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/subr_copy.c diff -u src/sys/kern/subr_copy.c:1.1 src/sys/kern/subr_copy.c:1.2 --- src/sys/kern/subr_copy.c:1.1 Wed Nov 4 16:54:00 2009 +++ src/sys/kern/subr_copy.c Sat Mar 28 16:13:38 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_copy.c,v 1.1 2009/11/04 16:54:00 pooka Exp $ */ +/* $NetBSD: subr_copy.c,v 1.2 2015/03/28 16:13:38 riastradh Exp $ */ /*- * Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008 The NetBSD Foundation, Inc. @@ -79,7 +79,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: subr_copy.c,v 1.1 2009/11/04 16:54:00 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_copy.c,v 1.2 2015/03/28 16:13:38 riastradh Exp $"); #include <sys/param.h> #include <sys/fcntl.h> @@ -211,12 +211,12 @@ copyin_vmspace(struct vmspace *vm, const if (len == 0) return (0); - if (VMSPACE_IS_KERNEL_P(vm)) { - return kcopy(uaddr, kaddr, len); - } if (__predict_true(vm == curproc->p_vmspace)) { return copyin(uaddr, kaddr, len); } + if (VMSPACE_IS_KERNEL_P(vm)) { + return kcopy(uaddr, kaddr, len); + } iov.iov_base = kaddr; iov.iov_len = len; @@ -244,12 +244,12 @@ copyout_vmspace(struct vmspace *vm, cons if (len == 0) return (0); - if (VMSPACE_IS_KERNEL_P(vm)) { - return kcopy(kaddr, uaddr, len); - } if (__predict_true(vm == curproc->p_vmspace)) { return copyout(kaddr, uaddr, len); } + if (VMSPACE_IS_KERNEL_P(vm)) { + return kcopy(kaddr, uaddr, len); + } iov.iov_base = __UNCONST(kaddr); /* XXXUNCONST cast away const */ iov.iov_len = len;