Source-Changes-HG archive

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

[src/trunk]: src/sys/kern - opt_kasan.h is included from <sys/asan.h>



details:   https://anonhg.NetBSD.org/src/rev/d229e81ecf48
branches:  trunk
changeset: 365583:d229e81ecf48
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Aug 22 14:12:30 2018 +0000

description:
- opt_kasan.h is included from <sys/asan.h>
- now that we are not using inlines, we need one more ifdef.

diffstat:

 sys/kern/kern_malloc.c |  14 ++------------
 sys/kern/subr_kmem.c   |   7 ++++---
 2 files changed, 6 insertions(+), 15 deletions(-)

diffs (84 lines):

diff -r 836cad72f7d5 -r d229e81ecf48 sys/kern/kern_malloc.c
--- a/sys/kern/kern_malloc.c    Wed Aug 22 14:11:26 2018 +0000
+++ b/sys/kern/kern_malloc.c    Wed Aug 22 14:12:30 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_malloc.c,v 1.152 2018/08/22 12:42:06 maxv Exp $   */
+/*     $NetBSD: kern_malloc.c,v 1.153 2018/08/22 14:12:30 christos Exp $       */
 
 /*
  * Copyright (c) 1987, 1991, 1993
@@ -70,11 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.152 2018/08/22 12:42:06 maxv Exp $");
-
-#ifdef _KERNEL_OPT
-#include "opt_kasan.h"
-#endif
+__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.153 2018/08/22 14:12:30 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/malloc.h>
@@ -115,9 +111,7 @@
        struct malloc_header *mh;
        void *p;
 
-#ifdef KASAN
        kasan_add_redzone(&size);
-#endif
 
        if (size >= PAGE_SIZE) {
                if (size > (ULONG_MAX-PAGE_SIZE))
@@ -144,9 +138,7 @@
 #endif
        mh++;
 
-#ifdef KASAN
        kasan_alloc(mh, origsize, size);
-#endif
 
        return mh;
 }
@@ -159,9 +151,7 @@
        mh = addr;
        mh--;
 
-#ifdef KASAN
        kasan_free(addr, mh->mh_size);
-#endif
 
        if (mh->mh_size >= PAGE_SIZE + sizeof(struct malloc_header))
                kmem_intr_free((char *)addr - PAGE_SIZE,
diff -r 836cad72f7d5 -r d229e81ecf48 sys/kern/subr_kmem.c
--- a/sys/kern/subr_kmem.c      Wed Aug 22 14:11:26 2018 +0000
+++ b/sys/kern/subr_kmem.c      Wed Aug 22 14:12:30 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_kmem.c,v 1.70 2018/08/22 09:38:21 maxv Exp $      */
+/*     $NetBSD: subr_kmem.c,v 1.71 2018/08/22 14:12:30 christos Exp $  */
 
 /*-
  * Copyright (c) 2009-2015 The NetBSD Foundation, Inc.
@@ -92,11 +92,10 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.70 2018/08/22 09:38:21 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_kmem.c,v 1.71 2018/08/22 14:12:30 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_kmem.h"
-#include "opt_kasan.h"
 #endif
 
 #include <sys/param.h>
@@ -224,7 +223,9 @@
 void *
 kmem_intr_alloc(size_t requested_size, km_flag_t kmflags)
 {
+#ifdef KASAN
        const size_t origsize = requested_size;
+#endif
        size_t allocsz, index;
        size_t size;
        pool_cache_t pc;



Home | Main Index | Thread Index | Old Index