DynamoRIO / DynamoRIO/dynamorio

max_bb_instrs off-by-one error

Open
#5,056 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
3.2k
Forks
629
Avg merge
2d 18h
Merged PRs (30d)
30

Description

**Describe the bug**

The max_bb_instrs option controls maximum instrs per basic block. We have seen (#4943) that the number of instrs in a basic block goes 1 beyond this option.

**To Reproduce**

```
$ cat main.c
int main ()
{
return 0;
}

$ gcc main.c

$ drrun -debug -loglevel 4 -max_bb_instrs 4 -t drcachesim -offline ./a.out

$ grep -m 1 reached /path/to/logs/a.out.82038.00000000/log.0.82038.html
reached -max_bb_instrs(4): 5, stopping
```

**Expected behavior**

The max bb size should stop at max_bb_instrs (4 in the example above).

**Screenshots or Pasted Text**

**Versions**
- What version of DynamoRIO are you using?

drrun version 8.0.18856 -- build 0

- Does the latest build from https://github.com/DynamoRIO/dynamorio/releases solve the problem?

No

- What operating system version are you running on? ("Windows 10" is *not* sufficient: give the release number.)

Ubuntu 18.04.5 LTS

- Is your application 32-bit or 64-bit?

64-bit

**Additional context**

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the provided main.c, gcc, and drrun command using -max_bb_instrs 4, then trace where the max_bb_instrs limit is checked and where the "reached" message is emitted. Confirm that a basic block stops at four instructions and that the diagnostic reports the corrected count.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.