kmsan.h (50b5e49ca694a60f84a2a12d62b6cb6ec8e3649f) kmsan.h (3c206509826094e85ead0b056f484db96829248d)
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Functions used by the KMSAN runtime.
4 *
5 * Copyright (C) 2017-2022 Google LLC
6 * Author: Alexander Potapenko <glider@google.com>
7 *
8 */

--- 53 unchanged lines hidden (view full) ---

62 */
63struct shadow_origin_ptr {
64 void *shadow, *origin;
65};
66
67struct shadow_origin_ptr kmsan_get_shadow_origin_ptr(void *addr, u64 size,
68 bool store);
69void *kmsan_get_metadata(void *addr, bool is_origin);
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Functions used by the KMSAN runtime.
4 *
5 * Copyright (C) 2017-2022 Google LLC
6 * Author: Alexander Potapenko <glider@google.com>
7 *
8 */

--- 53 unchanged lines hidden (view full) ---

62 */
63struct shadow_origin_ptr {
64 void *shadow, *origin;
65};
66
67struct shadow_origin_ptr kmsan_get_shadow_origin_ptr(void *addr, u64 size,
68 bool store);
69void *kmsan_get_metadata(void *addr, bool is_origin);
70void __init kmsan_init_alloc_meta_for_range(void *start, void *end);
70
71enum kmsan_bug_reason {
72 REASON_ANY,
73 REASON_COPY_TO_USER,
74 REASON_SUBMIT_URB,
75};
76
77void kmsan_print_origin(depot_stack_handle_t origin);

--- 104 unchanged lines hidden (view full) ---

182
183void kmsan_internal_task_create(struct task_struct *task);
184
185bool kmsan_metadata_is_contiguous(void *addr, size_t size);
186void kmsan_internal_check_memory(void *addr, size_t size, const void *user_addr,
187 int reason);
188
189struct page *kmsan_vmalloc_to_page_or_null(void *vaddr);
71
72enum kmsan_bug_reason {
73 REASON_ANY,
74 REASON_COPY_TO_USER,
75 REASON_SUBMIT_URB,
76};
77
78void kmsan_print_origin(depot_stack_handle_t origin);

--- 104 unchanged lines hidden (view full) ---

183
184void kmsan_internal_task_create(struct task_struct *task);
185
186bool kmsan_metadata_is_contiguous(void *addr, size_t size);
187void kmsan_internal_check_memory(void *addr, size_t size, const void *user_addr,
188 int reason);
189
190struct page *kmsan_vmalloc_to_page_or_null(void *vaddr);
191void kmsan_setup_meta(struct page *page, struct page *shadow,
192 struct page *origin, int order);
190
191/*
192 * kmsan_internal_is_module_addr() and kmsan_internal_is_vmalloc_addr() are
193 * non-instrumented versions of is_module_address() and is_vmalloc_addr() that
194 * are safe to call from KMSAN runtime without recursion.
195 */
196static inline bool kmsan_internal_is_module_addr(void *vaddr)
197{
198 return ((u64)vaddr >= MODULES_VADDR) && ((u64)vaddr < MODULES_END);
199}
200
201static inline bool kmsan_internal_is_vmalloc_addr(void *addr)
202{
203 return ((u64)addr >= VMALLOC_START) && ((u64)addr < VMALLOC_END);
204}
205
206#endif /* __MM_KMSAN_KMSAN_H */
193
194/*
195 * kmsan_internal_is_module_addr() and kmsan_internal_is_vmalloc_addr() are
196 * non-instrumented versions of is_module_address() and is_vmalloc_addr() that
197 * are safe to call from KMSAN runtime without recursion.
198 */
199static inline bool kmsan_internal_is_module_addr(void *vaddr)
200{
201 return ((u64)vaddr >= MODULES_VADDR) && ((u64)vaddr < MODULES_END);
202}
203
204static inline bool kmsan_internal_is_vmalloc_addr(void *addr)
205{
206 return ((u64)addr >= VMALLOC_START) && ((u64)addr < VMALLOC_END);
207}
208
209#endif /* __MM_KMSAN_KMSAN_H */