summaryrefslogtreecommitdiff
path: root/sys/arch/usermode
diff options
context:
space:
mode:
authormaxv <maxv@NetBSD.org>2020-06-30 16:20:00 +0000
committermaxv <maxv@NetBSD.org>2020-06-30 16:20:00 +0000
commitd71e829b1667ee97017ca18d4961794663efde77 (patch)
treeb3ec7724de772e54c01f5b10d5a0c9c351357571 /sys/arch/usermode
parent93e1c8dcb9762d5e43e53bf942f46e8f126ee417 (diff)
Make copystr() a MI C function, part of libkern and shared on all
architectures. Notes: - On alpha and ia64 the function is kept but gets renamed locally to avoid symbol collision. This is because on these two arches, I am not sure whether the ASM callers do not rely on fixed registers, so I prefer to keep the ASM body for now. - On Vax, only the symbol is removed, because the body is used from other functions. - On RISC-V, this change fixes a bug: copystr() was just a wrapper around strlcpy(), but strlcpy() makes the operation less safe (strlen on the source beyond its size). - The kASan, kCSan and kMSan wrappers are removed, because now that copystr() is in C, the compiler transformations are applied to it, without the need for manual wrappers. Could test on amd64 only, but should be fine.
Diffstat (limited to 'sys/arch/usermode')
-rw-r--r--sys/arch/usermode/usermode/copy.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/sys/arch/usermode/usermode/copy.c b/sys/arch/usermode/usermode/copy.c
index 0caa5150255..a8b3ff2fa51 100644
--- a/sys/arch/usermode/usermode/copy.c
+++ b/sys/arch/usermode/usermode/copy.c
@@ -1,4 +1,4 @@
-/* $NetBSD: copy.c,v 1.11 2019/04/10 04:10:54 thorpej Exp $ */
+/* $NetBSD: copy.c,v 1.12 2020/06/30 16:20:02 maxv Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: copy.c,v 1.11 2019/04/10 04:10:54 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: copy.c,v 1.12 2020/06/30 16:20:02 maxv Exp $");
#define __UFETCHSTORE_PRIVATE
#define __UCAS_PRIVATE
@@ -76,16 +76,6 @@ copyoutstr(const void *kaddr, void *uaddr, size_t len, size_t *done)
}
int
-copystr(const void *kfaddr, void *kdaddr, size_t len, size_t *done)
-{
- len = uimin(strnlen(kfaddr, len), len) + 1;
- strncpy(kdaddr, kfaddr, len);
- if (done)
- *done = len;
- return 0;
-}
-
-int
kcopy(const void *src, void *dst, size_t len)
{
memcpy(dst, src, len);