Loading...
1#ifndef _LIB_UBSAN_H
2#define _LIB_UBSAN_H
3
4enum {
5 type_kind_int = 0,
6 type_kind_float = 1,
7 type_unknown = 0xffff
8};
9
10struct type_descriptor {
11 u16 type_kind;
12 u16 type_info;
13 char type_name[1];
14};
15
16struct source_location {
17 const char *file_name;
18 union {
19 unsigned long reported;
20 struct {
21 u32 line;
22 u32 column;
23 };
24 };
25};
26
27struct overflow_data {
28 struct source_location location;
29 struct type_descriptor *type;
30};
31
32struct type_mismatch_data {
33 struct source_location location;
34 struct type_descriptor *type;
35 unsigned long alignment;
36 unsigned char type_check_kind;
37};
38
39struct nonnull_arg_data {
40 struct source_location location;
41 struct source_location attr_location;
42 int arg_index;
43};
44
45struct nonnull_return_data {
46 struct source_location location;
47 struct source_location attr_location;
48};
49
50struct vla_bound_data {
51 struct source_location location;
52 struct type_descriptor *type;
53};
54
55struct out_of_bounds_data {
56 struct source_location location;
57 struct type_descriptor *array_type;
58 struct type_descriptor *index_type;
59};
60
61struct shift_out_of_bounds_data {
62 struct source_location location;
63 struct type_descriptor *lhs_type;
64 struct type_descriptor *rhs_type;
65};
66
67struct unreachable_data {
68 struct source_location location;
69};
70
71struct invalid_value_data {
72 struct source_location location;
73 struct type_descriptor *type;
74};
75
76#if defined(CONFIG_ARCH_SUPPORTS_INT128) && defined(__SIZEOF_INT128__)
77typedef __int128 s_max;
78typedef unsigned __int128 u_max;
79#else
80typedef s64 s_max;
81typedef u64 u_max;
82#endif
83
84#endif
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _LIB_UBSAN_H
3#define _LIB_UBSAN_H
4
5enum {
6 type_kind_int = 0,
7 type_kind_float = 1,
8 type_unknown = 0xffff
9};
10
11struct type_descriptor {
12 u16 type_kind;
13 u16 type_info;
14 char type_name[1];
15};
16
17struct source_location {
18 const char *file_name;
19 union {
20 unsigned long reported;
21 struct {
22 u32 line;
23 u32 column;
24 };
25 };
26};
27
28struct overflow_data {
29 struct source_location location;
30 struct type_descriptor *type;
31};
32
33struct type_mismatch_data {
34 struct source_location location;
35 struct type_descriptor *type;
36 unsigned long alignment;
37 unsigned char type_check_kind;
38};
39
40struct type_mismatch_data_v1 {
41 struct source_location location;
42 struct type_descriptor *type;
43 unsigned char log_alignment;
44 unsigned char type_check_kind;
45};
46
47struct type_mismatch_data_common {
48 struct source_location *location;
49 struct type_descriptor *type;
50 unsigned long alignment;
51 unsigned char type_check_kind;
52};
53
54struct nonnull_arg_data {
55 struct source_location location;
56 struct source_location attr_location;
57 int arg_index;
58};
59
60struct out_of_bounds_data {
61 struct source_location location;
62 struct type_descriptor *array_type;
63 struct type_descriptor *index_type;
64};
65
66struct shift_out_of_bounds_data {
67 struct source_location location;
68 struct type_descriptor *lhs_type;
69 struct type_descriptor *rhs_type;
70};
71
72struct unreachable_data {
73 struct source_location location;
74};
75
76struct invalid_value_data {
77 struct source_location location;
78 struct type_descriptor *type;
79};
80
81#if defined(CONFIG_ARCH_SUPPORTS_INT128) && defined(__SIZEOF_INT128__)
82typedef __int128 s_max;
83typedef unsigned __int128 u_max;
84#else
85typedef s64 s_max;
86typedef u64 u_max;
87#endif
88
89#endif