1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
// Copyright 2024 syzkaller project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
#include "include/types.h"
#include "include/syscall.h"
typedef struct {
float f;
} anon_t;
struct empty_struct {
};
typedef int fd_t;
typedef struct forward forward_t;
struct anon_struct {
// Various tricky anon cases.
struct {
int x;
} a;
struct {
} b;
struct {
int y;
};
union {
int q;
long w;
};
anon_t foo;
forward_t* forward;
struct {
int a;
int b;
} array[4];
struct {
int a;
int b;
}* ptr;
struct {
int a;
int b;
}* ptr_array[4];
};
enum bitfield_enum { a,
b,
c };
struct bitfields {
int a : 1;
int : 2;
int b : 3;
long d : 2;
long pad : 3;
enum bitfield_enum e : 10;
int l : 10;
int* p __attribute__((counted_by(l)));
} __attribute__((aligned(32)));
struct packed_t {
char x;
int y;
} __attribute__((packed, aligned(32)));
struct various {
struct various* recursive;
struct recursive* next;
struct packed_t packed;
};
struct recursive {
struct various various;
};
SYSCALL_DEFINE1(types_syscall, struct anon_struct* p, struct empty_struct* y,
struct bitfields* b, int pid, fd_t f, struct various __user* v,
int __user* pi, u32 __user* pu)
{
return 0;
}
enum enum_foo {
enum_foo_a,
enum_foo_b,
};
typedef const enum {
enum_bar_a,
enum_bar_b,
} enum_bar;
SYSCALL_DEFINE1(types_syscall2, const enum enum_foo foo, const enum_bar bar)
{
return 0;
}
void anon_flow(int x)
{
struct anon_struct s;
s.a.x = x;
s.y = x;
s.w = x;
s.foo.f = x;
s.array[1].a = x;
s.ptr->a = x;
s.ptr_array[1]->b = x;
}
struct aligned_empty_struct {
} __attribute__((aligned(8)));
struct large_struct {
long foo[10];
};
struct align1 {
char f1;
long aligner[0];
char f2;
};
struct align2 {
char f1;
struct empty_struct aligner;
char f2;
};
struct align3 {
char f1;
struct aligned_empty_struct aligner;
char f2;
};
struct align4 {
char f1;
struct large_struct aligner[0];
char f2;
};
SYSCALL_DEFINE1(align_syscall, struct align1* a1, struct align2* a2, struct align3* a3, struct align4* a4)
{
return 0;
}
|