This is an archive of the discontinued LLVM Phabricator instance.

[asan] Provide bug descriptions for all reports (not just ErrorGeneric)
ClosedPublic

Authored by kubamracek on Nov 22 2016, 4:33 PM.

Details

Summary

ErrorGeneric report type has a const char *bug_descr, which describes the type of bug that is detected. Most non-generic bugs (e.g. double-free, null pointer dereference) also already have a short keyword used in printed reports (e.g. "double-free", "null-deref"). This patch moves the bug_descr field to ErrorBase and makes sure it's populated by all constructors.

Diff Detail

Repository
rL LLVM

Event Timeline

kubamracek updated this revision to Diff 78971.Nov 22 2016, 4:33 PM
kubamracek retitled this revision from to [asan] Provide bug descriptions for all reports (not just ErrorGeneric).
kubamracek updated this object.
kubamracek added reviewers: kcc, filcab, rnk.
kubamracek set the repository for this revision to rL LLVM.
kubamracek added a project: Restricted Project.
kubamracek added subscribers: llvm-commits, zaks.anna.
kubamracek updated this revision to Diff 78976.Nov 22 2016, 4:38 PM
kubamracek removed rL LLVM as the repository for this revision.
kubamracek updated this revision to Diff 78998.Nov 22 2016, 4:57 PM
rnk edited edge metadata.Nov 23 2016, 10:53 AM

Isn't this somewhat redundant with the buffer in ScarinessScoreBase?

struct ScarinessScoreBase {
  ...
  int score;
  char descr[1024];
};
filcab edited edge metadata.Nov 23 2016, 11:04 AM
In D27012#604558, @rnk wrote:

Isn't this somewhat redundant with the buffer in ScarinessScoreBase?

struct ScarinessScoreBase {
  ...
  int score;
  char descr[1024];
};

I was going to ask the same. And we have more information in the scariness score (e.g: in the param-overlap, and generic errors).
Maybe converting all the scattered bug_descr to use the scariness score would be better?

kubamracek edited edge metadata.

Isn't this somewhat redundant with the buffer in ScarinessScoreBase?
Maybe converting all the scattered bug_descr to use the scariness score would be better?

Makes sense. Updating the patch to use the description from scariness.

rnk added a comment.Nov 23 2016, 11:47 AM
In D27012#604558, @rnk wrote:

Isn't this somewhat redundant with the buffer in ScarinessScoreBase?

struct ScarinessScoreBase {
  ...
  int score;
  char descr[1024];
};

I was going to ask the same. And we have more information in the scariness score (e.g: in the param-overlap, and generic errors).
Maybe converting all the scattered bug_descr to use the scariness score would be better?

Well, it looks like it's not that redundant. If you look at the logic in ErrorGeneric, you see multiple calls to scariness.Scare, and that's where the complexity arises. I take it back, let's keep this separate.

Well, it looks like it's not that redundant. If you look at the logic in ErrorGeneric, you see multiple calls to scariness.Scare, and that's where the complexity arises. I take it back, let's keep this separate.

ErrorGeneric constructs scariness strings like "8-byte-write-heap-buffer-overflow-far-from-bounds", which is the description of this bug instance, whereas what I'm looking for is a description of a whole class, for the purposes of categorization, e.g. "heap-buffer-overflow", "double-free", "odr-violation" and such. So I slightly agree with you that this is a separate thing from the scariness description, but there's a lot of overlap.

So the previous patch looks good to you?

If ErrorGeneric is the only special one, why not use the scariness in general, but make that one a special case?
It's already special, so it's not really a big change.

If ErrorGeneric is the only special one, why not use the scariness in general, but make that one a special case?
It's already special, so it's not really a big change.

That's what the current patch does.

filcab accepted this revision.Nov 23 2016, 2:53 PM
filcab edited edge metadata.

Ah yes. Sorry about that.
Current patch LGTM!

This revision is now accepted and ready to land.Nov 23 2016, 2:53 PM

Thanks. Reid?

rnk accepted this revision.Nov 28 2016, 9:34 AM
rnk edited edge metadata.

lgtm, I see, ErrorGeneric still does ReportErrorSummary(bug_descr, &stack); Thanks!

This revision was automatically updated to reflect the committed changes.

Thanks for the review!