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
143
144
145
146
147
148
149
150
151
152
|
# Copyright 2021 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 <ioccom.h>
include <fcntl.h>
include <sys/types.h>
include <sys/time.h>
include <sys/socket.h>
include <net/if.h>
include <net/bpf.h>
resource fd_bpf[fd]
openat$bpf(fd const[AT_FDCWD], file ptr[in, string["/dev/bpf"]], flags flags[open_flags], mode const[0]) fd_bpf
define BIOCGDLTLIST32 3221766777
define BIOCSRTIMEOUT32 2148024941
define BIOCGRTIMEOUT32 1074283118
define BIOCSETF32 2148024935
define BIOCSETFNR32 2148024962
define BIOCSETWF32 2148024955
ioctl$BIOCGBLEN(fd fd_bpf, cmd const[BIOCGBLEN], arg ptr[out, int32])
ioctl$BIOCSBLEN(fd fd_bpf, cmd const[BIOCSBLEN], arg ptr[inout, int32])
ioctl$BIOCGDLT(fd fd_bpf, cmd const[BIOCGDLT], arg ptr[out, int32])
ioctl$BIOCGDLTLIST(fd fd_bpf, cmd const[BIOCGDLTLIST], arg ptr[inout, bpf_dltlist])
ioctl$BIOCSDLT(fd fd_bpf, cmd const[BIOCSDLT], arg ptr[in, int32])
ioctl$BIOCPROMISC(fd fd_bpf, cmd const[BIOCPROMISC])
ioctl$BIOCFLUSH(fd fd_bpf, cmd const[BIOCFLUSH])
ioctl$BIOCGETIF(fd fd_bpf, cmd const[BIOCGETIF], arg ptr[out, ifreq])
ioctl$BIOCSETIF(fd fd_bpf, cmd const[BIOCSETIF], arg ptr[in, ifreq])
ioctl$BIOCSRTIMEOUT(fd fd_bpf, cmd const[BIOCSRTIMEOUT], arg ptr[in, timeval])
ioctl$BIOCGRTIMEOUT(fd fd_bpf, cmd const[BIOCGRTIMEOUT], arg ptr[out, timeval])
ioctl$BIOCGSTATS(fd fd_bpf, cmd const[BIOCGSTATS], arg ptr[out, bpf_stat])
ioctl$BIOCIMMEDIATE(fd fd_bpf, cmd const[BIOCIMMEDIATE], arg ptr[in, int32])
ioctl$BIOCSETF(fd fd_bpf, cmd const[BIOCSETF], arg ptr[in, bpf_program])
ioctl$BIOCSETFNR(fd fd_bpf, cmd const[BIOCSETFNR], arg ptr[in, bpf_program])
ioctl$BIOCSETWF(fd fd_bpf, cmd const[BIOCSETWF], arg ptr[in, bpf_program])
ioctl$BIOCVERSION(fd fd_bpf, cmd const[BIOCVERSION], arg ptr[out, bpf_version])
ioctl$BIOCGRSIG(fd fd_bpf, cmd const[BIOCGRSIG], arg ptr[out, int32])
ioctl$BIOCSRSIG(fd fd_bpf, cmd const[BIOCSRSIG], arg ptr[in, int32])
ioctl$BIOCSHDRCMPLT(fd fd_bpf, cmd const[BIOCSHDRCMPLT], arg ptr[in, int32])
ioctl$BIOCGHDRCMPLT(fd fd_bpf, cmd const[BIOCGHDRCMPLT], arg ptr[out, int32])
ioctl$BIOCSDIRECTION(fd fd_bpf, cmd const[BIOCSDIRECTION], arg ptr[in, flags[direction_flags, int32]])
ioctl$BIOCGDIRECTION(fd fd_bpf, cmd const[BIOCGDIRECTION], arg ptr[out, int32])
ioctl$BIOCSTSTAMP(fd fd_bpf, cmd const[BIOCSTSTAMP], arg ptr[in, int32])
ioctl$BIOCGTSTAMP(fd fd_bpf, cmd const[BIOCGTSTAMP], arg ptr[out, int32])
ioctl$BIOCFEEDBACK(fd fd_bpf, cmd const[BIOCFEEDBACK], arg ptr[in, int32])
ioctl$BIOCLOCK(fd fd_bpf, cmd const[BIOCLOCK])
ioctl$BIOCGETBUFMODE(fd fd_bpf, cmd const[BIOCGETBUFMODE], arg ptr[out, int32])
ioctl$BIOCSETBUFMODE(fd fd_bpf, cmd const[BIOCSETBUFMODE], arg ptr[in, flags[bufmode_flags, int32]])
ioctl$BIOCSETZBUF(fd fd_bpf, cmd const[BIOCSETZBUF], arg ptr[in, bpf_zbuf])
ioctl$BIOCGETZMAX(fd fd_bpf, cmd const[BIOCGETZMAX], arg ptr[out, int32])
ioctl$BIOCROTZBUF(fd fd_bpf, cmd const[BIOCROTZBUF], arg ptr[out, bpf_zbuf])
ioctl$BIOCGDLTLIST32(fd fd_bpf, cmd const[BIOCGDLTLIST32], arg ptr[inout, bpf_dltlist32])
ioctl$BIOCSRTIMEOUT32(fd fd_bpf, cmd const[BIOCSRTIMEOUT32], arg ptr[in, timeval32])
ioctl$BIOCGRTIMEOUT32(fd fd_bpf, cmd const[BIOCGRTIMEOUT32], arg ptr[out, timeval32])
ioctl$BIOCSETF32(fd fd_bpf, cmd const[BIOCSETF32], arg ptr[in, bpf_program32])
ioctl$BIOCSETFNR32(fd fd_bpf, cmd const[BIOCSETFNR32], arg ptr[in, bpf_program32])
ioctl$BIOCSETWF32(fd fd_bpf, cmd const[BIOCSETWF32], arg ptr[in, bpf_program32])
bpf_dltlist32 {
bfl_len int32
bfl_list int32
}
bpf_dltlist {
bfl_len len[bfl_list, int32]
bfl_list ptr[in, array[int32]]
}
bpf_stat {
bs_recv int32
bs_drop int32
}
bpf_program32 {
bf_len int32
bf_insns int32
}
bpf_program {
bf_len len[bf_insns, int32]
bf_insns ptr[in, array[bpf_insn]]
}
define BPF_MAJOR_VERSION 1
define BPF_MINOR_VERSION 1
bpf_version {
bv_major const[BPF_MAJOR_VERSION, int16]
bv_minor const[BPF_MINOR_VERSION, int16]
}
bpf_insn {
code int16
jt int8
jf int8
k int32
}
bpf_zbuf {
bz_bufa ptr[in, array[int8]]
bz_bufb ptr[in, array[int8]]
bz_buflen len[bz_bufa, int32]
}
define IFNAMSIZ 16
ifreq {
ifr_name const[IFNAMSIZ, int8]
ifr_ifru ifr_ifru
}
ifreq_buffer {
length len[buffer, int32]
buffer ptr[in, array[int8]]
}
ifr_ifru [
ifru_addr sockaddr
ifru_dstaddr sockaddr
ifru_broadaddr sockaddr
ifru_buffer ifreq_buffer
ifru_flags array[int16, 2]
ifru_index int16
ifru_jid int32
ifru_metric int32
ifru_mtu int32
ifru_phys int32
ifru_media int32
ifru_data ptr[in, array[int8]]
ifru_cap array[int32, 2]
ifru_fib int32
ifru_vlan_pcp int8
]
sockaddr {
sa_len int8
sa_family flags[address_family, int8]
sa_data array[int8, 14]
}
timeval32 {
tv_sec int32
tv_used int32
}
address_family = AF_UNIX, AF_INET, AF_IMPLINK, AF_PUP, AF_CHAOS, AF_NETBIOS, AF_ISO, AF_OSI, AF_ECMA, AF_DATAKIT, AF_CCITT, AF_SNA, AF_DECnet, AF_DLI, AF_LAT, AF_HYLINK, AF_APPLETALK, AF_ROUTE, AF_LINK, pseudo_AF_XTP, AF_COIP, AF_CNT, pseudo_AF_RTIP, AF_IPX, AF_SIP, pseudo_AF_PIP, AF_ISDN, pseudo_AF_KEY, AF_INET6, AF_NATM, AF_ATM, pseudo_AF_HDRCMPLT, AF_NETGRAPH, AF_SLOW, AF_SCLUSTER, AF_ARP, AF_BLUETOOTH
direction_flags = BPF_D_IN, BPF_D_INOUT, BPF_D_OUT
bufmode_flags = BPF_BUFMODE_BUFFER, BPF_BUFMODE_ZBUF
|