Skip to content

Detecting longjmp when software tracing. #1780

@ptersilie

Description

@ptersilie

Currently we have no means of detecting longjmps when using the software tracer. This is mainly because we put yk_record_block calls at the beginning of blocks and when we jump to setjmp, which appears in the middle of a block, that block is missed. Here's a pseudo example (taken from one of the C tests):

int main() {
  if (setjmp(buf) == 9) {
    exit();
  }
  for (int i=0; i<10; i++) {
    if (i == 5) {
      longjmp(buf, 9);
    }
  }
}

Currently this succesfully generates a trace when it should abort with nonsensical control flow detected. In this case we can probably still detect this because the trace suddenly ends without ever seeing the control point again (do we allow such traces?).

However, it looks like it might be possible to construct a case where after going to setjmp (whose block we don't see) we enter straight back into the for-loop such that the control flow makes sense and suggest we never left the loop. We would have to experiment with this.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions