Repository navigation
Expand file tree
/
Copy pathtests.d
More file actions
executable file
·507 lines (489 loc) · 14.1 KB
/
Copy pathtests.d
File metadata and controls
executable file
·507 lines (489 loc) · 14.1 KB
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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
##################################################################
# These tests are designed to validate core functionality in dtrace
# on the installed operating system, such as bad address handling,
# and various probe functions. We dont really care about the output -
# other than some form of forward progress.
##################################################################
name: systrace-stringof-bad
note:
20110329 Validate pgfault handler intercepts bad addresses on
the bogus value from a return
d:
BEGIN {
cnt = 0;
tstart = timestamp;
}
syscall::open*:
{
this->pid = pid;
this->ppid = ppid;
this->execname = execname;
this->arg0 = stringof(arg0);
cnt++;
}
tick-1ms /timestamp - tstart > 5 * 1000 * 1000 * 1000 / {exit(0);}
tick-1s { printf("count so far: %d", cnt); }
tick-5s { exit(0); }
##################################################################
name: systrace-stringof-bad2
note:
Use some arg to generate a page fault - systrace-stringof-bad
may not generate a page fault depending on the value of arg0
when returning from the function.
d:
BEGIN {
cnt = 0;
tstart = timestamp;
}
syscall::open*: {
this->pid = pid;
this->ppid = ppid;
this->execname = execname;
this->arg0 = stringof(arg0);
this->arg1 = stringof(arg1);
this->arg2 = stringof(arg2);
cnt++;
}
syscall::open*: /timestamp - tstart > 5 * 1000 * 1000 * 1000 / {exit(0);}
tick-1ms /timestamp - tstart > 5 * 1000 * 1000 * 1000 / {exit(0);}
tick-1s { printf("count so far: %d", cnt); }
tick-5s { exit(0); }
##################################################################
name: systrace-stringof-bad3
note:
Be more dastardly trying to trigger a fault in dtrace_getarg -
just do stringof any of the args of any syscalls.
d:
BEGIN {
cnt = 0;
tstart = timestamp;
}
syscall::: {
this->pid = pid;
this->ppid = ppid;
this->execname = execname;
this->arg0 = stringof(arg0);
this->arg1 = stringof(arg1);
this->arg2 = stringof(arg2);
cnt++;
}
syscall::: /timestamp - tstart > 15 * 1000 * 1000 * 1000 / {exit(0);}
tick-1ms /timestamp - tstart > 15 * 1000 * 1000 * 1000 / {exit(0);}
tick-1s { printf("count so far: %d", cnt); }
tick-5s { exit(0); }
##################################################################
name: systrace-stringof-bad4
note:
Turn off the stringof, but otherwise the same as
systrace-stringof-bad3
d:
BEGIN {
cnt = 0;
tstart = timestamp;
}
syscall::: {
this->pid = pid;
this->ppid = ppid;
this->execname = execname;
cnt++;
}
syscall::: /timestamp - tstart > 5 * 1000 * 1000 * 1000 / {exit(0);}
tick-1ms /timestamp - tstart > 5 * 1000 * 1000 * 1000 / {exit(0);}
tick-1s { printf("count so far: %d", cnt); }
tick-5s { exit(0); }
##################################################################
name: systrace-stringof-bad5
note:
Force GPF interrupts to fire and ensure we catch them.
d:
BEGIN {
cnt = 0;
tstart = timestamp;
}
syscall::: {
this->pid = pid;
this->ppid = ppid;
this->execname = execname;
this->arg0 = stringof(0x000f);
this->arg0 = stringof(0x00f0);
this->arg0 = stringof(0x0f00);
this->arg0 = stringof(0xf000);
this->arg0 = stringof(0x000f0000);
this->arg0 = stringof(0x00f00000);
this->arg0 = stringof(0x0f000000);
this->arg0 = stringof(0xf0000000);
this->arg0 = stringof(0x000f00000000);
this->arg0 = stringof(0x00f000000000);
this->arg0 = stringof(0x0f0000000000);
this->arg0 = stringof(0xf00000000000);
this->arg0 = stringof(0x000f000000000000);
this->arg0 = stringof(0x00f0000000000000);
this->arg0 = stringof(0x0f00000000000000);
this->arg0 = stringof(0xf000000000000000);
cnt++;
}
/*syscall::: /timestamp - tstart > 15 * 1000 * 1000 * 1000 / {exit(0);}
tick-1ms /timestamp - tstart > 15 * 1000 * 1000 * 1000 / {exit(0);}*/
tick-1s { printf("count so far: %d", cnt); }
tick-5s { exit(0); }
##################################################################
name: high-profile1
note:
Lots of ticks to try and induce interrupt stacking/xcall
issues.
d:
BEGIN {
cnt = 0;
tstart = timestamp;
}
syscall::: {
this->pid = pid;
this->ppid = ppid;
this->execname = execname;
this->arg0 = stringof(arg0);
this->arg1 = stringof(arg1);
this->arg2 = stringof(arg2);
cnt++;
}
syscall::: /timestamp - tstart > 5 * 1000 * 1000 * 1000 / {exit(0);}
tick-5000 { }
tick-1s { printf("count so far: %d", cnt); }
tick-5s { exit(0); }
##################################################################
name: high-profile2
note:
Lots of ticks but no probes on syscalls.
issues.
d:
BEGIN {
cnt = 0;
}
tick-5000 { cnt++; }
tick-1s { printf("count so far: %d", cnt); }
tick-10s { exit(0); }
##################################################################
name: fbt-a
note: Do stuff to measure fbt heavy duty access.
d:
BEGIN {
tstart = timestamp;
}
fbt::a*:
{
cnt++;
}
tick-1ms /timestamp - tstart > 5 * 1000 * 1000 * 1000 / {exit(0);}
tick-1s { printf("count so far: %d", cnt); }
tick-5s { exit(0); }
##################################################################
name: fbt-abc
note: Do more stuff to measure fbt heavy duty access.
d:
fbt::a*:
{
cnt++;
}
tick-1s { printf("count so far: %d", cnt); }
tick-10s { exit(0); }
##################################################################
name: io-1
note: check io provider isnt causing page faults.
d:
BEGIN {
tstart = timestamp;
}
io::: { cnt++;}
tick-1ms /timestamp - tstart > 5 * 1000 * 1000 * 1000 / {exit(0);}
tick-1s { printf("count so far: %d", cnt); }
tick-5s { exit(0); }
##################################################################
name: execname-1
note: Simple use of execname
d:
BEGIN {
tstart = timestamp;
}
syscall::open*:entry {
cnt++;
printf("%s",execname);
}
tick-1ms /timestamp - tstart > 5 * 1000 * 1000 * 1000 / {exit(0);}
tick-5s { exit(0); }
##################################################################
name: copyinstr-1
note: Validate copyinstr isnt generating badaddr messages
d:
BEGIN {
tstart = timestamp;
}
syscall::open*:entry {
cnt++;
printf("%s %s",execname,copyinstr(arg0));
}
tick-1ms /timestamp - tstart > 5 * 1000 * 1000 * 1000 / {exit(0);}
tick-5s { exit(0); }
##################################################################
name: badptr-1
note: Simple badptr test (thanks Nigel Smith)
d:
BEGIN
{
x = (int *)NULL;
y = *x;
trace(y);
exit(0);
}
tick-1s { exit(0); }
##################################################################
name: profile-1
note: Check we dont lose a rare timer in the midst of lots of timers.
d:
int cnt;
tick-1s {
printf("got %d * 1mS ticks\n", cnt);
exit(0);
}
tick-1ms { cnt++; }
##################################################################
name: profile-2
note: Check we dont lose a rare timer in the midst of lots of timers.
d:
int cnt;
tick-1s {
printf("got %d * tick-5000 ticks\n", cnt);
exit(0);
}
tick-5000 { cnt++; }
##################################################################
name: profile-3
note: Check we dont lose a rare timer in the midst of lots of timers.
d:
int cnt_1ms, cnt_1s;
tick-1ms { cnt_1ms++; }
tick-1s { cnt_1s++;
printf("tick-1ms=%d tick-1s=%d", cnt_1ms, cnt_1s);
}
tick-5s {
printf("the end: got %d + %d\n", cnt_1ms, cnt_1s);
exit(0);
}
##################################################################
name: profile-4
note: Check we dont lose a rare timer in the midst of lots of timers.
d:
BEGIN {
tstart = timestamp;
}
int cnt_1ms, cnt_1s;
fbt::a*: {}
tick-1ms { cnt_1ms++; }
tick-1ms /timestamp - tstart > 5 * 1000 * 1000 * 1000 / {exit(0);}
tick-1s { cnt_1s++;
printf("tick-1ms=%d tick-1s=%d", cnt_1ms, cnt_1s);
}
tick-5s {
printf("the end: got %d + %d\n", cnt_1ms, cnt_1s);
exit(0);
}
##################################################################
name: profile-5
note: Check we dont lose a rare timer in the midst of lots of timers.
d:
int cnt_1ms, cnt_1s, cnt_fbt;
fbt::: {cnt_fbt++;}
tick-1ms { cnt_1ms++; }
tick-1s { cnt_1s++;
printf("tick-1ms=%d tick-1s=%d fbt=%d", cnt_1ms, cnt_1s, cnt_fbt);
}
tick-5s {
printf("the end: got %d + %d, fbt=%d\n", cnt_1ms, cnt_1s, cnt_fbt);
exit(0);
}
##################################################################
name: profile-6
note: Lots of severe timers whilst doing heavy fbt stuff. Attempt to
track for race conditions in timer destruction.
d:
fbt:::{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;} tick-1ms{cnt++;}
tick-5s {
exit(0);
}
##################################################################
name: quantize-1
note: Some random quantize invocations
d:
syscall:::entry { self->t = timestamp; }
syscall:::return {
@s[probefunc] = quantize(timestamp - self->t);
self->t = 0;
}
tick-5s {
exit(0);
}
##################################################################
name: quantize-2
note: Some random quantize invocations
d:
syscall:::entry { self->t = timestamp; }
syscall:::return {
@s[probefunc] = lquantize(timestamp - self->t, 0, 100000, 200);
self->t = 0;
}
tick-5s {
exit(0);
}
##################################################################
name: BEGIN-fbt:a-exec-time
note: Test from Nigel Smith
d:
fbt:kernel:a*: {}
dtrace:::BEGIN { exit(0); }
##################################################################
name: BEGIN-fbt:exec-time
note: Test from Nigel Smith
d:
fbt:kernel:: {}
dtrace:::BEGIN { exit(0); }
##################################################################
name: fbt-BEGIN-exit
note: Variant of bug report from Nigel Smith
d:
fbt:kernel:: BEGIN {exit(0); }
##################################################################
name: tcp-1
note: Check tcp probe. Ideally need to invoke TCP activity, but this will
just let us show we dont crash the kernel.
d:
tcp::: {printf("%s", execname); }
tick-5s {
exit(0);
}
##################################################################
name: vminfo-1
note: Check vminfo does something
d:
vminfo::: {printf("%s", execname); }
tick-5s {
exit(0);
}
##################################################################
name: tick-1
note: Some basic check of time sanity, e.g. num milliseconds in a second
d:
int cnt_1ms, cnt_1s;
tick-1ms {
cnt_1ms++;
printf("%d %d.%09d", cnt_1ms, timestamp / 1000000000,
timestamp % (1000000000));
}
tick-1s { cnt_1s++;
printf("tick-1ms=%d tick-1s=%d", cnt_1ms, cnt_1s);
cnt_1ms = 0;
}
tick-5s {
printf("the end: got %d + %d\n", cnt_1ms, cnt_1s);
exit(0);
}
##################################################################
name: tick-2
note: Make sure timers are not counting after we terminate dtrace.
Cant check that in the test itself, but this is designed to be
nasty.
d:
int cnt_1ms;
tick-1ms { cnt_1ms++;}
tick-2ms { cnt_1ms++;}
tick-3ms { cnt_1ms++;}
tick-4ms { cnt_1ms++;}
tick-5ms { cnt_1ms++;}
tick-6ms { cnt_1ms++;}
tick-7ms { cnt_1ms++;}
tick-8ms { cnt_1ms++;}
tick-9ms { cnt_1ms++;}
tick-10ms { cnt_1ms++;}
tick-5s {
exit(0);
}
##################################################################
name: tick-3
note: 1s worth of 1m ticks.
d:
int cnt_1ms;
tick-1ms {
cnt_1ms++;
}
tick-1s {
printf("cnt_1ms=%d in 1 second", cnt_1ms);
cnt_1ms = 0;
}
tick-5s {
exit(0);
}
##################################################################
name: instr-1
note: Some checks on the instruction provider. Helps us to determine
if the single step works properly, and recursion. Much more
invasive than fbt (because there are more probes).
d:
instr::a*-j*: { cnt++;}
tick-1ms {exit(0);}
##################################################################
name: llquantize-1
note: test llquantize parsing works
d:
tick-1ms
{
/*
* A log-linear quantization with factor of 10 ranging from magnitude
* 0 to magnitude 6 (inclusive) with twenty steps per magnitude
*/
@ = llquantize(i++, 10, 0, 6, 20);
}
tick-1ms
/i == 1500/
{
exit(0);
}
##################################################################
name: ctf-print-1
note: demonstrate printing a structure based on the ctf data description.
We use an arbitrary (stupid) symbol (this is a code symbol).
d:
BEGIN {
print(*((struct file *)&`dtrace_match_nonzero));
exit(0);
}
##################################################################
name: page_fault
note: See if we can probe this successfully
d:
fbt::page_fault:{printf("%s", execname);}
tick-5s: { exit(0); }