Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Mark several kASan functions with __nothing, to avoid an...
details: https://anonhg.NetBSD.org/src/rev/adefb936967a
branches: trunk
changeset: 461074:adefb936967a
user: maxv <maxv%NetBSD.org@localhost>
date: Thu Nov 14 17:09:22 2019 +0000
description:
Mark several kASan functions with __nothing, to avoid annoying #ifdefs.
Same as kCSan and kMSan.
diffstat:
sys/arch/aarch64/aarch64/aarch64_machdep.c | 6 ++----
sys/arch/aarch64/aarch64/pmap.c | 6 ++----
sys/arch/amd64/amd64/machdep.c | 8 ++------
sys/arch/x86/x86/pmap.c | 8 ++------
sys/sys/asan.h | 8 ++++++--
5 files changed, 14 insertions(+), 22 deletions(-)
diffs (164 lines):
diff -r ce955028c575 -r adefb936967a sys/arch/aarch64/aarch64/aarch64_machdep.c
--- a/sys/arch/aarch64/aarch64/aarch64_machdep.c Thu Nov 14 16:56:13 2019 +0000
+++ b/sys/arch/aarch64/aarch64/aarch64_machdep.c Thu Nov 14 17:09:22 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: aarch64_machdep.c,v 1.33 2019/11/14 16:48:51 maxv Exp $ */
+/* $NetBSD: aarch64_machdep.c,v 1.34 2019/11/14 17:09:22 maxv Exp $ */
/*-
* Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.33 2019/11/14 16:48:51 maxv Exp $");
+__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.34 2019/11/14 17:09:22 maxv Exp $");
#include "opt_arm_debug.h"
#include "opt_ddb.h"
@@ -434,9 +434,7 @@
*/
pmap_bootstrap(kernelvmstart, VM_MAX_KERNEL_ADDRESS);
-#ifdef KASAN
kasan_init();
-#endif
/*
* setup lwp0
diff -r ce955028c575 -r adefb936967a sys/arch/aarch64/aarch64/pmap.c
--- a/sys/arch/aarch64/aarch64/pmap.c Thu Nov 14 16:56:13 2019 +0000
+++ b/sys/arch/aarch64/aarch64/pmap.c Thu Nov 14 17:09:22 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.49 2019/11/14 16:48:51 maxv Exp $ */
+/* $NetBSD: pmap.c,v 1.50 2019/11/14 17:09:22 maxv Exp $ */
/*
* Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.49 2019/11/14 16:48:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.50 2019/11/14 17:09:22 maxv Exp $");
#include "opt_arm_debug.h"
#include "opt_ddb.h"
@@ -1681,11 +1681,9 @@
opte = atomic_swap_64(ptep, 0);
need_sync_icache = (prot & VM_PROT_EXECUTE);
-#ifdef KASAN
if (!user) {
kasan_shadow_map((void *)va, PAGE_SIZE);
}
-#endif
/* for lock ordering for pg and opg */
pgs[0] = pg;
diff -r ce955028c575 -r adefb936967a sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c Thu Nov 14 16:56:13 2019 +0000
+++ b/sys/arch/amd64/amd64/machdep.c Thu Nov 14 17:09:22 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.340 2019/11/14 16:48:51 maxv Exp $ */
+/* $NetBSD: machdep.c,v 1.341 2019/11/14 17:09:23 maxv Exp $ */
/*
* Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -110,7 +110,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.340 2019/11/14 16:48:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.341 2019/11/14 17:09:23 maxv Exp $");
#include "opt_modular.h"
#include "opt_user_ldt.h"
@@ -1684,9 +1684,7 @@
init_pte();
-#ifdef KASAN
kasan_early_init((void *)lwp0uarea);
-#endif
uvm_lwp_setuarea(&lwp0, lwp0uarea);
@@ -1766,9 +1764,7 @@
init_x86_msgbuf();
-#ifdef KASAN
kasan_init();
-#endif
kcsan_init();
kmsan_init((void *)lwp0uarea);
diff -r ce955028c575 -r adefb936967a sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c Thu Nov 14 16:56:13 2019 +0000
+++ b/sys/arch/x86/x86/pmap.c Thu Nov 14 17:09:22 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.339 2019/11/14 16:23:52 maxv Exp $ */
+/* $NetBSD: pmap.c,v 1.340 2019/11/14 17:09:23 maxv Exp $ */
/*
* Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -130,14 +130,13 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.339 2019/11/14 16:23:52 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.340 2019/11/14 17:09:23 maxv Exp $");
#include "opt_user_ldt.h"
#include "opt_lockdebug.h"
#include "opt_multiprocessor.h"
#include "opt_xen.h"
#include "opt_svs.h"
-#include "opt_kasan.h"
#include "opt_kaslr.h"
#include <sys/param.h>
@@ -4573,11 +4572,8 @@
}
#endif
-#ifdef KASAN
kasan_shadow_map((void *)pmap_maxkvaddr,
(size_t)(maxkvaddr - pmap_maxkvaddr));
-#endif
-
kmsan_shadow_map((void *)pmap_maxkvaddr,
(size_t)(maxkvaddr - pmap_maxkvaddr));
diff -r ce955028c575 -r adefb936967a sys/sys/asan.h
--- a/sys/sys/asan.h Thu Nov 14 16:56:13 2019 +0000
+++ b/sys/sys/asan.h Thu Nov 14 17:09:22 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: asan.h,v 1.11 2019/10/04 06:27:42 maxv Exp $ */
+/* $NetBSD: asan.h,v 1.12 2019/11/14 17:09:23 maxv Exp $ */
/*
* Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -60,9 +60,10 @@
#define KASAN_DMA_UIO 3
#define KASAN_DMA_RAW 4
-void kasan_shadow_map(void *, size_t);
void kasan_early_init(void *);
void kasan_init(void);
+void kasan_shadow_map(void *, size_t);
+
void kasan_softint(struct lwp *);
void kasan_dma_sync(bus_dmamap_t, bus_addr_t, bus_size_t, int);
@@ -71,6 +72,9 @@
void kasan_add_redzone(size_t *);
void kasan_mark(const void *, size_t, size_t, uint8_t);
#else
+#define kasan_early_init(u) __nothing
+#define kasan_init() __nothing
+#define kasan_shadow_map(a, s) __nothing
#define kasan_dma_sync(m, a, s, o) __nothing
#define kasan_dma_load(m, b, s, o) __nothing
#define kasan_add_redzone(s) __nothing
Home |
Main Index |
Thread Index |
Old Index