This is an archive of the discontinued LLVM Phabricator instance.

[profile][Fuchsia] Use build ID for the raw profile name
Needs ReviewPublic

Authored by phosek on Aug 18 2020, 3:35 PM.

Details

Reviewers
mcgrathr
Summary

This is uniquely identifies the profile just like the module signature,
but unlike module signature it also allows easily mapping the profile
back to the corresponding binary.

Diff Detail

Event Timeline

phosek requested review of this revision.Aug 18 2020, 3:35 PM
phosek created this revision.

Even with the bugs fixed, I'm not very sanguine about truncating to 31 chars.

compiler-rt/lib/profile/InstrProfilingPlatformFuchsia.c
114

There can be multiple PT_NOTE entries.

119

Both n_namesz and n_descsz need to be rounded up to 4.

122

here too

125

The bound can go negative if descsz > N/2.
Also, the return value of snprintf will always be 2, even if the bound constrains it from writing.
So this will always yield L=descsz*2 and the caller will overrun the buffer.

168

The name limit is only 32, while common build ID algorithms like sha1 will need 40 chars.
(By spec there is no bound on build ID size, but in other places we've capped it at 256 bits, which needs 64 chars of hex.)