Skip to content
Permalink
Browse files

sys/openbsd: add diskmap descriptions

  • Loading branch information...
mptre committed Jul 10, 2019
1 parent f62e1e8 commit ff7bf04c7ca7e08d726e35dc73780dd3c3f80b68
Showing with 54 additions and 2 deletions.
  1. +1 −1 executor/defs.h
  2. +2 −0 executor/syscalls.h
  3. +23 −0 sys/openbsd/dev_diskmap.txt
  4. +7 −0 sys/openbsd/dev_diskmap_amd64.const
  5. +21 −1 sys/openbsd/gen/amd64.go
@@ -140,7 +140,7 @@

#if GOARCH_amd64
#define GOARCH "amd64"
#define SYZ_REVISION "7f4015fe5d4b3777d30d2d5dd379e3de766e0e8e"
#define SYZ_REVISION "33de16487cc0a0d25eaa32ea4166bbbc75d2994e"
#define SYZ_EXECUTOR_USES_FORK_SERVER 1
#define SYZ_EXECUTOR_USES_SHMEM 1
#define SYZ_PAGE_SIZE 4096
{"ioctl$BIOCSRSIG", 54},
{"ioctl$BIOCSRTIMEOUT", 54},
{"ioctl$BIOCVERSION", 54},
{"ioctl$DIOCMAP", 54},
{"ioctl$FIOASYNC", 54},
{"ioctl$FIOGETOWN", 54},
{"ioctl$FIONBIO", 54},
{"open$dir", 5},
{"openat", 321},
{"openat$bpf", 321},
{"openat$diskmap", 321},
{"openat$klog", 321},
{"openat$null", 321},
{"openat$pci", 321},
@@ -0,0 +1,23 @@
# Copyright 2019 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 <sys/param.h>
include <sys/ioctl.h>
include <sys/fcntl.h>

include <sys/disk.h>
include <sys/dkio.h>

resource fd_diskmap[fd]

openat$diskmap(fd const[AT_FDCWD], file ptr[in, string["/dev/diskmap"]], flags flags[open_flags], mode const[0]) fd_diskmap

ioctl$DIOCMAP(fd fd_diskmap, cmd const[DIOCMAP], arg ptr[in, dk_diskmap])

dk_diskmap {
device ptr[in, filename]
fd fd
flags flags[dk_diskmap_flags, int32]
}

dk_diskmap_flags = DM_OPENPART, DM_OPENBLCK
@@ -0,0 +1,7 @@
# AUTOGENERATED FILE
AT_FDCWD = 18446744073709551516
DIOCMAP = 3222299767
DM_OPENBLCK = 2
DM_OPENPART = 1
SYS_ioctl = 54
SYS_openat = 321
@@ -15,6 +15,7 @@ var resources_amd64 = []*ResourceDesc{
{Name: "fd", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"fd"}, Values: []uint64{18446744073709551615, 18446744073709551516}},
{Name: "fd_bpf", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"fd", "fd_bpf"}, Values: []uint64{18446744073709551615, 18446744073709551516}},
{Name: "fd_dir", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"fd", "fd_dir"}, Values: []uint64{18446744073709551615, 18446744073709551516}},
{Name: "fd_diskmap", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"fd", "fd_diskmap"}, Values: []uint64{18446744073709551615, 18446744073709551516}},
{Name: "fd_klog", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"fd", "fd_klog"}, Values: []uint64{18446744073709551615, 18446744073709551516}},
{Name: "fd_kqueue", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"fd", "fd_kqueue"}, Values: []uint64{18446744073709551615, 18446744073709551516}},
{Name: "fd_pci", Type: &IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int32", TypeSize: 4}}}, Kind: []string{"fd", "fd_pci"}, Values: []uint64{18446744073709551615, 18446744073709551516}},
@@ -89,6 +90,11 @@ var structDescs_amd64 = []*KeyedStruct{
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "type", TypeSize: 4}}, Val: 1},
&ArrayType{TypeCommon: TypeCommon{TypeName: "array", FldName: "fds", IsVarlen: true}, Type: &ResourceType{TypeCommon: TypeCommon{TypeName: "fd", TypeSize: 4}}},
}, AlignAttr: 8}},
{Key: StructKey{Name: "dk_diskmap"}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "dk_diskmap", TypeSize: 16}, Fields: []Type{
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "device", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "filename", IsVarlen: true}, Kind: 3}},
&ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "dk_diskmap_flags", FldName: "flags", TypeSize: 4}}, Vals: []uint64{1, 2}, BitMask: true},
}}},
{Key: StructKey{Name: "fd_set", Dir: 2}, Desc: &StructDesc{TypeCommon: TypeCommon{TypeName: "fd_set", TypeSize: 64, ArgDir: 2}, Fields: []Type{
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "mask0", TypeSize: 8, ArgDir: 2}}},
&IntType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "int64", FldName: "mask1", TypeSize: 8, ArgDir: 2}}},
@@ -1200,6 +1206,11 @@ var syscalls_amd64 = []*Syscall{
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 1074020977},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "arg", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "bpf_version", Dir: 1}}},
}},
{NR: 54, Name: "ioctl$DIOCMAP", CallName: "ioctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "fd_diskmap", FldName: "fd", TypeSize: 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 3222299767},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "arg", TypeSize: 8}, Type: &StructType{Key: StructKey{Name: "dk_diskmap"}}},
}},
{NR: 54, Name: "ioctl$FIOASYNC", CallName: "ioctl", Args: []Type{
&ResourceType{TypeCommon: TypeCommon{TypeName: "fd", FldName: "fd", TypeSize: 4}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "cmd", TypeSize: 8}}, Val: 2147772029},
@@ -1838,6 +1849,12 @@ var syscalls_amd64 = []*Syscall{
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "open_flags", FldName: "flags", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 8, 512, 1024, 2048, 16, 32, 256, 65536, 128, 128, 128, 32768, 131072, 64}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "mode", TypeSize: 8}}},
}, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "fd_bpf", FldName: "ret", TypeSize: 4, ArgDir: 1}}},
{NR: 321, Name: "openat$diskmap", CallName: "openat", Args: []Type{
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "fd", TypeSize: 8}}, Val: 18446744073709551516},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "file", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "string", TypeSize: 13}, Kind: 2, Values: []string{"/dev/diskmap\x00"}}},
&FlagsType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "open_flags", FldName: "flags", TypeSize: 8}}, Vals: []uint64{0, 1, 2, 8, 512, 1024, 2048, 16, 32, 256, 65536, 128, 128, 128, 32768, 131072, 64}},
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "mode", TypeSize: 8}}},
}, Ret: &ResourceType{TypeCommon: TypeCommon{TypeName: "fd_diskmap", FldName: "ret", TypeSize: 4, ArgDir: 1}}},
{NR: 321, Name: "openat$klog", CallName: "openat", Args: []Type{
&ConstType{IntTypeCommon: IntTypeCommon{TypeCommon: TypeCommon{TypeName: "const", FldName: "fd", TypeSize: 8}}, Val: 18446744073709551516},
&PtrType{TypeCommon: TypeCommon{TypeName: "ptr", FldName: "file", TypeSize: 8}, Type: &BufferType{TypeCommon: TypeCommon{TypeName: "string", TypeSize: 10}, Kind: 2, Values: []string{"/dev/klog\x00"}}},
@@ -2444,6 +2461,9 @@ var consts_amd64 = []ConstValue{
{Name: "CLOCK_PROCESS_CPUTIME_ID", Value: 2},
{Name: "CLOCK_REALTIME"},
{Name: "CLOCK_THREAD_CPUTIME_ID", Value: 4},
{Name: "DIOCMAP", Value: 3222299767},
{Name: "DM_OPENBLCK", Value: 2},
{Name: "DM_OPENPART", Value: 1},
{Name: "EVFILT_AIO", Value: 18446744073709551613},
{Name: "EVFILT_DEVICE", Value: 18446744073709551608},
{Name: "EVFILT_PROC", Value: 18446744073709551611},
@@ -2981,4 +3001,4 @@ var consts_amd64 = []ConstValue{
{Name: "__MAP_NOREPLACE", Value: 2048},
}

const revision_amd64 = "7f4015fe5d4b3777d30d2d5dd379e3de766e0e8e"
const revision_amd64 = "33de16487cc0a0d25eaa32ea4166bbbc75d2994e"

0 comments on commit ff7bf04

Please sign in to comment.
You can’t perform that action at this time.