Program Analysis Tools Flashcards

1
Q

Why are bugs costly to fix?

A

The longer it’s hidden, the more code may rely on it

Finding the root cause is difficult after the fact

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

Why do tests not catch all bugs?

A

Testing is best effort at best

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

What are some proactive ways to prevent bugs from appearing?

A

Search for known classes of bugs
Guard against certain classes of bugs
Prove that certain bugs are not present
Identify bad styles that may lead to bugs

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

What is program analysis?

A

Tools and techniques that allows computers to automatically reason about the program’s behaviour

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

Why would we want to push program analysis onto computers?

A

Computers excel at repetitive, subtle behaviour

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

Why are errors like Apple’s goto fail issue so hard to catch for humans even though simple program analysis tools would be easily able to find it.

A

People are bad at identifying subtle details. Computers will analyze everything line by line with glossing over anything

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

What are the 2 main categories of program analysis tools?

A

Dynamic and static analysis

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

What do dynamic analysis tools do? What is it best used for? What are some examples?

A

Run the program under test and reason about that single execution
Best used for explaining bugs that are already happening
Debuggers, valgrind

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

What do static analysis tools do? What is it best used for? What are some examples?

A

Examine source code/binary and reason about all possible executions
Best used for identifying bugs that haven’t struck yet but might in the future

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

What are the limitations of dynamic approaches? How about static approaches?

A

Dynamic: As it’s driven by a single input, it will miss bugs caused by other inputs (false negatives)
Static: Because of undecidibility, it cannot be totally sure that there is a problem when it detects one (halting problem) (false positives)

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

Most large companies are finding __________ to be unacceptable, which makes static approaches less widely used

A

false positives

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

What does Valgrind use to analyse code?

A

Dynamic Binary Instrumentation. It’s like JVM for machine code

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

What are some built in tools for Valgrind?

A

Memcheck, cachegrind, helgrind

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

What does Valgrind not work for Java or Python by default?

A

Valgrind modifies a compiled C binary to check for errors, not other binaries

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

What do Clang sanitizers use to analyse code?

A

Compile time instrumentation and rewrites the program once to perform analyses every time it executes

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

Clang sanitizers are used a lot at ______

A

google

17
Q

Valgrind cannot detect invalid accesses of _____ ______ because of ________ ______ _______. What can detect these errors?

A

local variables, dynamic runtime instrumentation

Address Sanitizers

18
Q

When using a sampling tool, sampling ______ matters

A

frequency

19
Q

What is the general rule for sampling rate?

A

Twice the frequency of the operations you’re measuring

20
Q

What does the clang static analyzer ‘scan-build’ do?

A

Uses abstract interpretation to simulate many different paths though the program at once

21
Q

False ______ are no extra burden, but false ______ can waste developer time

A

negatives, positives

22
Q

What is one way to deal with false positives?

A

Save time in the future by blacklisting and suppressing previous types of false positives

23
Q

What is program verification? What is a tool that does this?

A

Proving the absence of certain types of bugs

CBMC

24
Q

What are some issues with program verification tools?

A

Difficult to use
More complex -> more overhead
Still approximate (will miss bugs in the end)