1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * A minimal header declaring types added by KMSAN to existing kernel structs.
4  *
5  * Copyright (C) 2017-2022 Google LLC
6  * Author: Alexander Potapenko <glider@google.com>
7  *
8  */
9 #ifndef _LINUX_KMSAN_TYPES_H
10 #define _LINUX_KMSAN_TYPES_H
11 
12 /* These constants are defined in the MSan LLVM instrumentation pass. */
13 #define KMSAN_RETVAL_SIZE 800
14 #define KMSAN_PARAM_SIZE 800
15 
16 struct kmsan_context_state {
17 	char param_tls[KMSAN_PARAM_SIZE];
18 	char retval_tls[KMSAN_RETVAL_SIZE];
19 	char va_arg_tls[KMSAN_PARAM_SIZE];
20 	char va_arg_origin_tls[KMSAN_PARAM_SIZE];
21 	u64 va_arg_overflow_size_tls;
22 	char param_origin_tls[KMSAN_PARAM_SIZE];
23 	u32 retval_origin_tls;
24 };
25 
26 #undef KMSAN_PARAM_SIZE
27 #undef KMSAN_RETVAL_SIZE
28 
29 struct kmsan_ctx {
30 	struct kmsan_context_state cstate;
31 	int kmsan_in_runtime;
32 	bool allow_reporting;
33 };
34 
35 #endif /* _LINUX_KMSAN_TYPES_H */
36