blob: 810874203f6e9bde8cf029bc7b6ba5b59f385611 (
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
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
|
# $OpenBSD: Makefile,v 1.6 2020/12/17 14:22:42 bluhm Exp $
# Call unveil(2) in combination with unlink(2), chroot(2), chdir(2).
# Use umount(8) to check that the mountpoint leaks no vnode.
# There were vnode reference counting bugs in the kernel.
PROGS= unveil-unlink unveil-chroot unveil-perm unveil-chdir
CLEANFILES= diskimage
.PHONY: mount unconfig clean
diskimage: unconfig
${SUDO} dd if=/dev/zero of=diskimage bs=512 count=4k
${SUDO} vnconfig vnd0 diskimage
${SUDO} newfs vnd0c
mount: diskimage
${SUDO} mkdir -p /mnt/regress-unveil
${SUDO} mount /dev/vnd0c /mnt/regress-unveil
unconfig:
-${SUDO} umount -f /dev/vnd0c 2>/dev/null || true
-${SUDO} rmdir /mnt/regress-unveil 2>/dev/null || true
-${SUDO} vnconfig -u vnd0 2>/dev/null || true
-${SUDO} rm -f stamp-setup
REGRESS_SETUP = ${PROGS} mount
REGRESS_CLEANUP = unconfig
REGRESS_TARGETS =
REGRESS_TARGETS += run-unlink
run-unlink:
${SUDO} mkdir -p /mnt/regress-unveil/foo
${SUDO} ./unveil-unlink /mnt/regress-unveil/foo bar
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chroot
run-chroot:
${SUDO} mkdir -p /mnt/regress-unveil
${SUDO} ./unveil-chroot /mnt/regress-unveil /
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chroot-dir
run-chroot-dir:
${SUDO} mkdir -p /mnt/regress-unveil/foo
${SUDO} ./unveil-chroot /mnt/regress-unveil/foo /
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chroot-unveil-dir
run-chroot-unveil-dir:
${SUDO} mkdir -p /mnt/regress-unveil/foo
${SUDO} ./unveil-chroot /mnt/regress-unveil /foo
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chroot-dir-unveil-dir
run-chroot-dir-unveil-dir:
${SUDO} mkdir -p /mnt/regress-unveil/foo/bar
${SUDO} ./unveil-chroot /mnt/regress-unveil/foo /bar
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chroot-rootslash
run-chroot-rootslash:
${SUDO} mkdir -p /mnt/regress-unveil
${SUDO} ./unveil-chroot /mnt/regress-unveil //
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chroot-open
run-chroot-open:
${SUDO} mkdir -p /mnt/regress-unveil
${SUDO} touch /mnt/regress-unveil/baz
${SUDO} ./unveil-chroot /mnt/regress-unveil / /baz
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chroot-dir-open
run-chroot-dir-open:
${SUDO} mkdir -p /mnt/regress-unveil/foo
${SUDO} touch /mnt/regress-unveil/foo/baz
${SUDO} ./unveil-chroot /mnt/regress-unveil/foo / /baz
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chroot-unveil-dir-open
run-chroot-unveil-dir-open:
${SUDO} mkdir -p /mnt/regress-unveil/foo
${SUDO} touch /mnt/regress-unveil/foo/baz
${SUDO} ./unveil-chroot /mnt/regress-unveil /foo /baz
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chroot-dir-unveil-dir-open
run-chroot-dir-unveil-dir-open:
${SUDO} mkdir -p /mnt/regress-unveil/foo/bar
${SUDO} touch /mnt/regress-unveil/foo/bar/baz
${SUDO} ./unveil-chroot /mnt/regress-unveil/foo /bar /baz
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chroot-rootslash-open
run-chroot-rootslash-open:
${SUDO} mkdir -p /mnt/regress-unveil
${SUDO} touch /mnt/regress-unveil/baz
${SUDO} ./unveil-chroot /mnt/regress-unveil // /baz
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chroot-open-rootslash
run-chroot-open-rootslash:
${SUDO} mkdir -p /mnt/regress-unveil
${SUDO} touch /mnt/regress-unveil/baz
${SUDO} ./unveil-chroot /mnt/regress-unveil / //baz
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chroot-unveil-rootdot-open
run-chroot-unveil-rootdot-open:
${SUDO} mkdir -p /mnt/regress-unveil
${SUDO} touch /mnt/regress-unveil/baz
${SUDO} ./unveil-chroot /mnt/regress-unveil /. /baz
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chroot-unveil-rootdotdot-open
run-chroot-unveil-rootdotdot-open:
${SUDO} mkdir -p /mnt/regress-unveil
${SUDO} touch /mnt/regress-unveil/baz
${SUDO} ./unveil-chroot /mnt/regress-unveil /.. /baz
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-perm
run-perm:
${SUDO} mkdir -p /mnt/regress-unveil
${SUDO} ./unveil-perm "" /mnt/regress-unveil
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-perm-dir
run-perm-dir:
${SUDO} mkdir -p /mnt/regress-unveil/foo
${SUDO} ./unveil-perm "" /mnt/regress-unveil/foo
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-perm-open
run-perm-open:
${SUDO} mkdir -p /mnt/regress-unveil
${SUDO} touch /mnt/regress-unveil/baz
${SUDO} ./unveil-perm "" /mnt/regress-unveil baz
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-perm-dir-open
run-perm-dir-open:
${SUDO} mkdir -p /mnt/regress-unveil/foo
${SUDO} touch /mnt/regress-unveil/foo/baz
${SUDO} ./unveil-perm "" /mnt/regress-unveil/foo baz
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-perm-create-open
run-perm-create-open:
${SUDO} mkdir -p /mnt/regress-unveil
${SUDO} touch /mnt/regress-unveil/baz
${SUDO} ./unveil-perm "c" /mnt/regress-unveil baz
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-perm-dir-create-open
run-perm-dir-create-open:
${SUDO} mkdir -p /mnt/regress-unveil/foo
${SUDO} touch /mnt/regress-unveil/foo/baz
${SUDO} ./unveil-perm "c" /mnt/regress-unveil/foo baz
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-perm-write-open
run-perm-write-open:
${SUDO} mkdir -p /mnt/regress-unveil
${SUDO} touch /mnt/regress-unveil/baz
${SUDO} ./unveil-perm "w" /mnt/regress-unveil baz
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-perm-dir-write-open
run-perm-dir-write-open:
${SUDO} mkdir -p /mnt/regress-unveil/foo
${SUDO} touch /mnt/regress-unveil/foo/baz
${SUDO} ./unveil-perm "w" /mnt/regress-unveil/foo baz
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chdir
run-chdir:
${SUDO} mkdir -p /mnt/regress-unveil
${SUDO} ./unveil-chdir /mnt/regress-unveil .
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chdir-dir
run-chdir-dir:
${SUDO} mkdir -p /mnt/regress-unveil/foo
${SUDO} ./unveil-chdir /mnt/regress-unveil/foo .
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chdir-unveil-dir
run-chdir-unveil-dir:
${SUDO} mkdir -p /mnt/regress-unveil/foo
${SUDO} ./unveil-chdir /mnt/regress-unveil foo
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chdir-unveil-backdir
run-chdir-unveil-backdir:
${SUDO} mkdir -p /mnt/regress-unveil/foo
${SUDO} ./unveil-chdir /mnt/regress-unveil foo/..
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chdir-unveil-dotdot
run-chdir-unveil-dotdot:
${SUDO} mkdir -p /mnt/regress-unveil/foo
${SUDO} ./unveil-chdir /mnt/regress-unveil/foo ..
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chdir-dir-unveil-dir
run-chdir-dir-unveil-dir:
${SUDO} mkdir -p /mnt/regress-unveil/foo/bar
${SUDO} ./unveil-chdir /mnt/regress-unveil/foo bar
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chdir-dir-unveil-backdir
run-chdir-dir-unveil-backdir:
${SUDO} mkdir -p /mnt/regress-unveil/foo/bar
${SUDO} ./unveil-chdir /mnt/regress-unveil/foo bar/..
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chdir-dir-unveil-dotdot
run-chdir-dir-unveil-dotdot:
${SUDO} mkdir -p /mnt/regress-unveil/foo/bar
${SUDO} ./unveil-chdir /mnt/regress-unveil/foo/bar ..
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chdir-open
run-chdir-open:
${SUDO} mkdir -p /mnt/regress-unveil
${SUDO} touch /mnt/regress-unveil/baz
${SUDO} ./unveil-chdir /mnt/regress-unveil . baz
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chdir-dir-open
run-chdir-dir-open:
${SUDO} mkdir -p /mnt/regress-unveil/foo
${SUDO} touch /mnt/regress-unveil/foo/baz
${SUDO} ./unveil-chdir /mnt/regress-unveil/foo . baz
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chdir-unveil-dir-open
run-chdir-unveil-dir-open:
${SUDO} mkdir -p /mnt/regress-unveil/foo
${SUDO} touch /mnt/regress-unveil/foo/baz
${SUDO} ./unveil-chdir /mnt/regress-unveil foo baz
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chdir-unveil-backdir-open
run-chdir-unveil-backdir-open:
${SUDO} mkdir -p /mnt/regress-unveil/foo
${SUDO} touch /mnt/regress-unveil/baz
${SUDO} ./unveil-chdir /mnt/regress-unveil foo/.. baz
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chdir-unveil-dotdot-open
run-chdir-unveil-dotdot-open:
${SUDO} mkdir -p /mnt/regress-unveil/foo
${SUDO} touch /mnt/regress-unveil/baz
${SUDO} ./unveil-chdir /mnt/regress-unveil/foo .. baz
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chdir-dir-unveil-dir-open
run-chdir-dir-unveil-dir-open:
${SUDO} mkdir -p /mnt/regress-unveil/foo/bar
${SUDO} touch /mnt/regress-unveil/foo/bar/baz
${SUDO} ./unveil-chdir /mnt/regress-unveil/foo bar baz
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chdir-dir-unveil-backdir-open
run-chdir-dir-unveil-backdir-open:
${SUDO} mkdir -p /mnt/regress-unveil/foo/bar
${SUDO} touch /mnt/regress-unveil/foo/baz
${SUDO} ./unveil-chdir /mnt/regress-unveil/foo bar/.. baz
${SUDO} umount /mnt/regress-unveil
REGRESS_TARGETS += run-chdir-dir-unveil-dotdot-open
run-chdir-dir-unveil-dotdot-open:
${SUDO} mkdir -p /mnt/regress-unveil/foo/bar
${SUDO} touch /mnt/regress-unveil/foo/baz
${SUDO} ./unveil-chdir /mnt/regress-unveil/foo/bar .. baz
${SUDO} umount /mnt/regress-unveil
REGRESS_ROOT_TARGETS = ${REGRESS_TARGETS}
.include <bsd.regress.mk>
|