| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: asan.h,v 1.4 2018/08/22 11:55:28 martin Exp $ */ | | 1 | /* $NetBSD: asan.h,v 1.5 2018/08/22 12:14:29 kre Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2018 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2018 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Maxime Villard. | | 8 | * by Maxime Villard. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -29,34 +29,41 @@ | | | @@ -29,34 +29,41 @@ |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #ifndef _SYS_ASAN_H_ | | 32 | #ifndef _SYS_ASAN_H_ |
33 | #define _SYS_ASAN_H_ | | 33 | #define _SYS_ASAN_H_ |
34 | | | 34 | |
35 | #include <sys/types.h> | | 35 | #include <sys/types.h> |
36 | | | 36 | |
37 | #ifdef KASAN | | 37 | #ifdef KASAN |
38 | void kasan_add_redzone(size_t *); | | 38 | void kasan_add_redzone(size_t *); |
39 | void kasan_alloc(const void *, size_t, size_t); | | 39 | void kasan_alloc(const void *, size_t, size_t); |
40 | void kasan_free(const void *, size_t); | | 40 | void kasan_free(const void *, size_t); |
41 | #else | | 41 | #else |
| | | 42 | #if 0 |
| | | 43 | /* there are type issues - kmem_alloc() takes a u_long size not size_t */ |
42 | static void __inline __unused | | 44 | static void __inline __unused |
43 | kasan_add_redzone(size_t *size __unused) | | 45 | kasan_add_redzone(size_t *size __unused) |
44 | { | | 46 | { |
45 | /* nothing */ | | 47 | /* nothing */ |
46 | } | | 48 | } |
47 | | | 49 | |
48 | static void __inline __unused | | 50 | static void __inline __unused |
49 | kasan_alloc(const void *addr __unused, size_t size __unused, | | 51 | kasan_alloc(const void *addr __unused, size_t size __unused, |
50 | size_t sz_with_redz __unused) | | 52 | size_t sz_with_redz __unused) |
51 | { | | 53 | { |
52 | /* nothing */ | | 54 | /* nothing */ |
53 | } | | 55 | } |
54 | | | 56 | |
55 | static void __inline __unused | | 57 | static void __inline __unused |
56 | kasan_free(const void *addr __unused, size_t sz_with_redz __unused) | | 58 | kasan_free(const void *addr __unused, size_t sz_with_redz __unused) |
57 | { | | 59 | { |
58 | /* nothing */ | | 60 | /* nothing */ |
59 | } | | 61 | } |
| | | 62 | #else |
| | | 63 | #define kasan_add_redzone(SP) __nothing |
| | | 64 | #define kasan_alloc(P, S1, S2) __nothing |
| | | 65 | #define kasan_free(P, S) __nothing |
| | | 66 | #endif |
60 | #endif | | 67 | #endif |
61 | | | 68 | |
62 | #endif /* !_SYS_ASAN_H_ */ | | 69 | #endif /* !_SYS_ASAN_H_ */ |