L3 Flashcards

1
Q

random testing (fuzzing)

A
  • Feed random input to a program
  • Observe whether it behaves correctly (execution satisfies specs or doesn’t crash)
  • a special case of mutation analysis
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

inf monkey theorem

A

a monkey hitting keys at random on a typewriter keyboard for an infinite amount of time will almost surely type a given text

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

first popular fuzzing study

A

Barton Miller, U of Wisconsin, command-line fuzzer testing Unix programs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

security bug: gets() in C and how to fix

A
  • cause reliability issues and security breach (buffer overflow)
  • second most common cause of error
  • fix using fgets(), which limits the max input length
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

popular fuzz testing tool for mobile app

A
  • google’s monkey tool

- usually used to generate a sequence of events with delay

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

monkey tool: generate gesture: slide unlock

A

down(x1, y1)
move(x2, y2)
up(x2, y2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

concurrency delay in practice

A

introduce a random delay in each thread, fuzz the thread scheduler

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

advantages of cuzz

A
  • introduce sleep automatically and systematically before each statement
  • give worst-case probabilistic guarantee on finding bugs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

bug depth

A
  • the number of ordering constraints a schedule needs to satisfy
  • only count dependency across threads
  • observation from cuzz: many typical bugs have a small depth
  • useful metric for concurrency testing efforts
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

dead lock

A

neither thread can make any progress because the one of the thread is holding the lock

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

cuzz probability of finding the bug

A

1/(n*(k^(d-1)), worst case
n bugs, k steps, d depth
1/n for choosing the correct first thread
1/k for switching thread at the correct step
1/(k^(d-1)) for choosing the correct d-1 statements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

why measured != worst-case

A
  • having more threads gives more ways to trigger a bug
  • if the bug can be found in multiple ways, the probabilities add up
  • worst case guarantee is for hardest to find bug of given depth
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

cuzz vs stress testing

A

cuzz is much better:

  • systematic randomization improves concurrency testing.
  • effective in flushing out bugs with existing tests
  • scale to large number of threads, long-running tests
  • low adoption barrier
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

pros of random testings

A
  • easy to implement
  • good coverage given enough test
  • can work with programs in any format
  • appealing to find security vulnerabilities
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

cons of random testings

A
  • inefficient (especially for later states)
  • might find unimportant bugs
  • poor coverage
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

should fuzzing replace systematic, formal testing?

A

No

17
Q

recommended applications for fuzzing

A

testing security, mobile apps, and concurrency

18
Q

not recommended applications for fuzzing

A
  • replacing systematic, formal testing

- system with multiple layers (compilers)

19
Q

thread schedule is decided by

A
  • scheduler of the running OS
  • non-deterministic across different runs. Although a particular run on an input succeeds, another run on the same input might crash