mirror of
https://github.com/reactos/syzkaller.git
synced 2025-02-26 22:55:47 +00:00

Change all 'filename' to 'ptr[in, filename]' and don't imply pointer indirection for filename type. This is necessary because in some bases we want to embed filename directly into a struct (e.g. unix sock addr). Similar change was already done for string type for similar reasons. Generally, we want to imply as less as possible. NOTE: IF YOU HAVE PRIVATE DESCRIPTIONS, YOU NEED TO DO THE SAME REPLACEMENT.
123 lines
3.5 KiB
Plaintext
123 lines
3.5 KiB
Plaintext
# Copyright 2015 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.
|
|
|
|
# Note these sysctls have radical effect on code paths inside of kernel:
|
|
# net.core.bpf_jit_enable = { 0, 1, 2 }
|
|
# net.core.bpf_jit_harden = { 0, 1, 2 }
|
|
|
|
include <linux/bpf.h>
|
|
|
|
resource fd_bpf_map[fd]: BPF_PSEUDO_MAP_FD
|
|
resource fd_bpf_prog[fd]
|
|
|
|
bpf$MAP_CREATE(cmd const[BPF_MAP_CREATE], arg ptr[in, bpf_map_create_arg], size len[arg]) fd_bpf_map
|
|
bpf$MAP_LOOKUP_ELEM(cmd const[BPF_MAP_LOOKUP_ELEM], arg ptr[in, bpf_map_lookup_arg], size len[arg])
|
|
bpf$MAP_UPDATE_ELEM(cmd const[BPF_MAP_UPDATE_ELEM], arg ptr[in, bpf_map_update_arg], size len[arg])
|
|
bpf$MAP_DELETE_ELEM(cmd const[BPF_MAP_DELETE_ELEM], arg ptr[in, bpf_map_delete_arg], size len[arg])
|
|
bpf$MAP_GET_NEXT_KEY(cmd const[BPF_MAP_GET_NEXT_KEY], arg ptr[in, bpf_map_get_next_arg], size len[arg])
|
|
bpf$PROG_LOAD(cmd const[BPF_PROG_LOAD], arg ptr[in, bpf_prog], size len[arg]) fd_bpf_prog
|
|
bpf$OBJ_PIN_MAP(cmd const[BPF_OBJ_PIN], arg ptr[in, bpf_obj_pin_map], size len[arg])
|
|
bpf$OBJ_PIN_PROG(cmd const[BPF_OBJ_PIN], arg ptr[in, bpf_obj_pin_prog], size len[arg])
|
|
bpf$OBJ_GET_MAP(cmd const[BPF_OBJ_GET], arg ptr[in, bpf_obj_get], size len[arg]) fd_bpf_map
|
|
bpf$OBJ_GET_PROG(cmd const[BPF_OBJ_GET], arg ptr[in, bpf_obj_get], size len[arg]) fd_bpf_prog
|
|
bpf$BPF_PROG_ATTACH(cmd const[BPF_PROG_ATTACH], arg ptr[in, bpf_attach_arg], size len[arg])
|
|
bpf$BPF_PROG_DETACH(cmd const[BPF_PROG_DETACH], arg ptr[in, bpf_detach_arg], size len[arg])
|
|
|
|
bpf_map_create_arg {
|
|
type flags[bpf_map_type, int32]
|
|
ksize int32
|
|
vsize int32
|
|
max int32
|
|
flags flags[map_flags, int32]
|
|
}
|
|
|
|
bpf_map_lookup_arg {
|
|
map fd_bpf_map
|
|
key buffer[in]
|
|
val buffer[out]
|
|
}
|
|
|
|
bpf_map_update_arg {
|
|
map fd_bpf_map
|
|
key buffer[in]
|
|
val buffer[in]
|
|
flags flags[bpf_map_flags, int64]
|
|
}
|
|
|
|
bpf_map_delete_arg {
|
|
map fd_bpf_map
|
|
key buffer[in]
|
|
}
|
|
|
|
bpf_map_get_next_arg {
|
|
map fd_bpf_map
|
|
key buffer[in]
|
|
next buffer[out]
|
|
}
|
|
|
|
bpf_prog {
|
|
type flags[bpf_prog_type, int32]
|
|
ninsn len[insns, int32]
|
|
insns ptr[in, array[bpf_insn]]
|
|
license ptr[in, string]
|
|
loglev int32
|
|
logsize len[log, int32]
|
|
log buffer[out]
|
|
kver int32
|
|
}
|
|
|
|
bpf_insn [
|
|
generic bpf_insn_generic
|
|
map bpf_insn_map
|
|
]
|
|
|
|
#TODO: consider providing specialized structs for all opcodes (or opcode groups)
|
|
# For example, for lots of opcodes some fields must be 0, otherwise verifier will bark
|
|
bpf_insn_generic {
|
|
code int8
|
|
regs int8
|
|
off int16
|
|
imm int32
|
|
}
|
|
|
|
bpf_insn_map {
|
|
code int8
|
|
regs int8
|
|
off int16
|
|
imm fd_bpf_map
|
|
}
|
|
|
|
# Note: these filenames must be on bpf filesystem
|
|
bpf_obj_pin_map {
|
|
path ptr[in, filename]
|
|
fd fd_bpf_map
|
|
}
|
|
|
|
bpf_obj_pin_prog {
|
|
path ptr[in, filename]
|
|
fd fd_bpf_prog
|
|
}
|
|
|
|
bpf_obj_get {
|
|
path ptr[in, filename]
|
|
fd const[0, int32]
|
|
}
|
|
|
|
bpf_attach_arg {
|
|
target fd
|
|
prog fd_bpf_prog
|
|
type flags[bpf_attach_type, int32]
|
|
}
|
|
|
|
bpf_detach_arg {
|
|
target const[0, int32]
|
|
prog fd_bpf_prog
|
|
type flags[bpf_attach_type, int32]
|
|
}
|
|
|
|
bpf_map_type = BPF_MAP_TYPE_HASH, BPF_MAP_TYPE_ARRAY, BPF_MAP_TYPE_PROG_ARRAY, BPF_MAP_TYPE_PERF_EVENT_ARRAY, BPF_MAP_TYPE_STACK_TRACE, BPF_MAP_TYPE_CGROUP_ARRAY, BPF_MAP_TYPE_PERCPU_HASH, BPF_MAP_TYPE_PERCPU_ARRAY, BPF_MAP_TYPE_LRU_HASH, BPF_MAP_TYPE_LRU_PERCPU_HASH
|
|
bpf_map_flags = BPF_ANY, BPF_NOEXIST, BPF_EXIST
|
|
bpf_prog_type = BPF_PROG_TYPE_SOCKET_FILTER, BPF_PROG_TYPE_KPROBE, BPF_PROG_TYPE_SCHED_CLS, BPF_PROG_TYPE_SCHED_ACT, BPF_PROG_TYPE_TRACEPOINT, BPF_PROG_TYPE_XDP, BPF_PROG_TYPE_PERF_EVENT, BPF_PROG_TYPE_CGROUP_SKB
|
|
map_flags = BPF_F_NO_PREALLOC, BPF_F_NO_COMMON_LRU
|
|
bpf_attach_type = BPF_CGROUP_INET_INGRESS, BPF_CGROUP_INET_EGRESS
|