Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Instrument copyout() in kCSan, for parity with kMSan.
details: https://anonhg.NetBSD.org/src/rev/48d143eff45c
branches: trunk
changeset: 461082:48d143eff45c
user: maxv <maxv%NetBSD.org@localhost>
date: Fri Nov 15 08:11:36 2019 +0000
description:
Instrument copyout() in kCSan, for parity with kMSan.
diffstat:
sys/kern/subr_csan.c | 14 ++++++++++++--
sys/sys/systm.h | 5 +++--
2 files changed, 15 insertions(+), 4 deletions(-)
diffs (76 lines):
diff -r 434623eee6a8 -r 48d143eff45c sys/kern/subr_csan.c
--- a/sys/kern/subr_csan.c Fri Nov 15 01:10:42 2019 +0000
+++ b/sys/kern/subr_csan.c Fri Nov 15 08:11:36 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_csan.c,v 1.4 2019/11/14 16:56:13 maxv Exp $ */
+/* $NetBSD: subr_csan.c,v 1.5 2019/11/15 08:11:37 maxv Exp $ */
/*
* Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_csan.c,v 1.4 2019/11/14 16:56:13 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_csan.c,v 1.5 2019/11/15 08:11:37 maxv Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -326,17 +326,20 @@
#undef copyinstr
#undef copyoutstr
#undef copyin
+#undef copyout
int kcsan_kcopy(const void *, void *, size_t);
int kcsan_copystr(const void *, void *, size_t, size_t *);
int kcsan_copyinstr(const void *, void *, size_t, size_t *);
int kcsan_copyoutstr(const void *, void *, size_t, size_t *);
int kcsan_copyin(const void *, void *, size_t);
+int kcsan_copyout(const void *, void *, size_t);
int kcopy(const void *, void *, size_t);
int copystr(const void *, void *, size_t, size_t *);
int copyinstr(const void *, void *, size_t, size_t *);
int copyoutstr(const void *, void *, size_t, size_t *);
int copyin(const void *, void *, size_t);
+int copyout(const void *, void *, size_t);
int
kcsan_kcopy(const void *src, void *dst, size_t len)
@@ -361,6 +364,13 @@
}
int
+kcsan_copyout(const void *kaddr, void *uaddr, size_t len)
+{
+ kcsan_access((uintptr_t)kaddr, len, false, false, __RET_ADDR);
+ return copyout(kaddr, uaddr, len);
+}
+
+int
kcsan_copyinstr(const void *uaddr, void *kaddr, size_t len, size_t *done)
{
kcsan_access((uintptr_t)kaddr, len, true, false, __RET_ADDR);
diff -r 434623eee6a8 -r 48d143eff45c sys/sys/systm.h
--- a/sys/sys/systm.h Fri Nov 15 01:10:42 2019 +0000
+++ b/sys/sys/systm.h Fri Nov 15 08:11:36 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: systm.h,v 1.289 2019/11/14 16:23:53 maxv Exp $ */
+/* $NetBSD: systm.h,v 1.290 2019/11/15 08:11:36 maxv Exp $ */
/*-
* Copyright (c) 1982, 1988, 1991, 1993
@@ -299,11 +299,12 @@
int kcsan_copyinstr(const void *, void *, size_t, size_t *);
int kcsan_copyoutstr(const void *, void *, size_t, size_t *);
int kcsan_copyin(const void *, void *, size_t);
-int copyout(const void *, void *, size_t);
+int kcsan_copyout(const void *, void *, size_t);
#define copystr kcsan_copystr
#define copyinstr kcsan_copyinstr
#define copyoutstr kcsan_copyoutstr
#define copyin kcsan_copyin
+#define copyout kcsan_copyout
#elif defined(_KERNEL) && defined(KMSAN)
int kmsan_copystr(const void *, void *, size_t, size_t *);
int kmsan_copyinstr(const void *, void *, size_t, size_t *);
Home |
Main Index |
Thread Index |
Old Index