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#include <linux/types.h>
13
14/* These constants are defined in the MSan LLVM instrumentation pass. */
15#define KMSAN_RETVAL_SIZE 800
16#define KMSAN_PARAM_SIZE 800
17
18struct kmsan_context_state {
19	char param_tls[KMSAN_PARAM_SIZE];
20	char retval_tls[KMSAN_RETVAL_SIZE];
21	char va_arg_tls[KMSAN_PARAM_SIZE];
22	char va_arg_origin_tls[KMSAN_PARAM_SIZE];
23	u64 va_arg_overflow_size_tls;
24	char param_origin_tls[KMSAN_PARAM_SIZE];
25	u32 retval_origin_tls;
26};
27
28#undef KMSAN_PARAM_SIZE
29#undef KMSAN_RETVAL_SIZE
30
31struct kmsan_ctx {
32	struct kmsan_context_state cstate;
33	int kmsan_in_runtime;
34	bool allow_reporting;
35};
36
37#endif /* _LINUX_KMSAN_TYPES_H */
38