Module Name: src
Committed By: maxv
Date: Wed Apr 15 17:28:26 UTC 2020
Modified Files:
src/sys/kern: subr_csan.c
Log Message:
Drop the todo and qualify the accesses.
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/kern/subr_csan.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_csan.c
diff -u src/sys/kern/subr_csan.c:1.7 src/sys/kern/subr_csan.c:1.8
--- src/sys/kern/subr_csan.c:1.7 Thu Apr 2 16:31:37 2020
+++ src/sys/kern/subr_csan.c Wed Apr 15 17:28:26 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_csan.c,v 1.7 2020/04/02 16:31:37 maxv Exp $ */
+/* $NetBSD: subr_csan.c,v 1.8 2020/04/15 17:28:26 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.7 2020/04/02 16:31:37 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_csan.c,v 1.8 2020/04/15 17:28:26 maxv Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -606,14 +606,10 @@ CSAN_ATOMIC_FUNC_INC(uint, unsigned int,
CSAN_ATOMIC_FUNC_INC(ulong, unsigned long, unsigned long);
CSAN_ATOMIC_FUNC_INC(ptr, void *, void);
-/*
- * TODO: these two functions should qualify as atomic accesses. However
- * for now we just whitelist them, to reduce the output.
- */
-
void
kcsan_atomic_load(const volatile void *p, void *v, int size)
{
+ kcsan_access((uintptr_t)p, size, false, true, __RET_ADDR);
switch (size) {
case 1: *(uint8_t *)v = *(const volatile uint8_t *)p; break;
case 2: *(uint16_t *)v = *(const volatile uint16_t *)p; break;
@@ -625,6 +621,7 @@ kcsan_atomic_load(const volatile void *p
void
kcsan_atomic_store(volatile void *p, const void *v, int size)
{
+ kcsan_access((uintptr_t)p, size, true, true, __RET_ADDR);
switch (size) {
case 1: *(volatile uint8_t *)p = *(const uint8_t *)v; break;
case 2: *(volatile uint16_t *)p = *(const uint16_t *)v; break;