aboutsummaryrefslogtreecommitdiffstats
path: root/sys/openbsd/init_test.go
blob: c4ec0c0bb3d9d0e6b85e26294a5351eddaadfff5 (plain)
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
// 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.

package openbsd_test

import (
	"testing"

	"github.com/google/syzkaller/prog"
	_ "github.com/google/syzkaller/sys/openbsd/gen"
)

func TestNeutralize(t *testing.T) {
	prog.TestDeserializeHelper(t, "openbsd", "amd64", nil, []prog.DeserializeTest{
		{
			In:  `chflagsat(0x0, 0x0, 0x60004, 0x0)`,
			Out: `chflagsat(0x0, 0x0, 0x0, 0x0)`,
		},
		{
			In:  `fchflags(0x0, 0x60004)`,
			Out: `fchflags(0x0, 0x0)`,
		},
		// Note, a random ioctl description used since only the command
		// is of importance.
		{
			In:  `ioctl$BIOCSDIRFILT(0x0, 0xc0e04429, 0x0)`,
			Out: `ioctl$BIOCSDIRFILT(0x0, 0x0, 0x0)`,
		},
		{
			In:  `ioctl$BIOCSDIRFILT(0x0, 0xc0e04412, 0x0)`,
			Out: `ioctl$BIOCSDIRFILT(0x0, 0x0, 0x0)`,
		},
		{
			// major=22, minor=232
			In:  `mknodat(0x0, 0x0, 0x0, 0x16e8)`,
			Out: `mknodat(0x0, 0x0, 0x0, 0x202)`,
		},
		{
			// major=22, minor=232
			In:  `mknod(0x0, 0x0, 0x16e8)`,
			Out: `mknod(0x0, 0x0, 0x202)`,
		},
		{
			// major=22, minor=0
			In: `mknod(0x0, 0x0, 0x1600)`,
		},
		{
			// major=4, minor=0
			In: `mknod(0x0, 0x0, 0x400)`,
		},
		{
			// major=4, minor=1
			In:  `mknod(0x0, 0x0, 0x401)`,
			Out: `mknod(0x0, 0x0, 0x202)`,
		},
		{
			// major=4, minor=2
			In:  `mknod(0x0, 0x0, 0x402)`,
			Out: `mknod(0x0, 0x0, 0x202)`,
		},
		{
			// MCL_CURRENT | MCL_FUTURE
			In:  `mlockall(0x3)`,
			Out: `mlockall(0x1)`,
		},
		{
			// RLIMIT_DATA
			In:  `setrlimit(0x2, &(0x7f0000cc0ff0)={0x0, 0x80000000})`,
			Out: `setrlimit(0x2, &(0x7f0000cc0ff0)={0x60000000, 0x80000000})`,
		},
		{
			// RLIMIT_DATA
			In:  `setrlimit(0x10000000000002, &(0x7f0000cc0ff0)={0x0, 0x80000000})`,
			Out: `setrlimit(0x10000000000002, &(0x7f0000cc0ff0)={0x60000000, 0x80000000})`,
		},
		{
			// RLIMIT_STACK
			In:  `setrlimit(0x3, &(0x7f0000cc0ff0)={0x1000000000, 0x1000000000})`,
			Out: `setrlimit(0x3, &(0x7f0000cc0ff0)={0x100000, 0x100000})`,
		},
		{
			// RLIMIT_CPU
			In: `setrlimit(0x0, &(0x7f0000cc0ff0)={0x1, 0x1})`,
		},
	})
}