Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Drop the todo and qualify the accesses.



details:   https://anonhg.NetBSD.org/src/rev/f0d0dad1963f
branches:  trunk
changeset: 1009189:f0d0dad1963f
user:      maxv <maxv%NetBSD.org@localhost>
date:      Wed Apr 15 17:28:26 2020 +0000

description:
Drop the todo and qualify the accesses.

diffstat:

 sys/kern/subr_csan.c |  11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diffs (42 lines):

diff -r 03514af77ad1 -r f0d0dad1963f sys/kern/subr_csan.c
--- a/sys/kern/subr_csan.c      Wed Apr 15 17:16:22 2020 +0000
+++ b/sys/kern/subr_csan.c      Wed Apr 15 17:28:26 2020 +0000
@@ -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(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 @@
 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;



Home | Main Index | Thread Index | Old Index