This is an archive of the discontinued LLVM Phabricator instance.

[SanitizerCoverage] Fix wrong pointer type return from CreateSecStartEnd()
ClosedPublic

Authored by yingcong-wu on Nov 2 2022, 7:09 PM.

Details

Summary

CreateSecStartEnd() will return pointer to the input type, so when called with CreateSecStartEnd(M, SanCovCFsSectionName, IntptrPtrTy), SecStartEnd.first and SecStartEnd.second will have type IntptrPtrPtrTy, not IntptrPtrTy.

This problem should not impact the functionality and with opaque pointer enable, this will not trigger any alarm. But if runs with -no-opaque-pointers, this mismatch pointer type will cause type check assertion in CallInst::init() to fail.

Diff Detail

Event Timeline

yingcong-wu created this revision.Nov 2 2022, 7:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 2 2022, 7:09 PM
yingcong-wu retitled this revision from fix wrong pointer type return from CreateSecStartEnd() to [NFC] fix wrong pointer type return from CreateSecStartEnd().Nov 2 2022, 7:15 PM
yingcong-wu edited the summary of this revision. (Show Details)
yingcong-wu edited the summary of this revision. (Show Details)
yingcong-wu published this revision for review.Nov 2 2022, 7:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptNov 2 2022, 7:20 PM
yingcong-wu retitled this revision from [NFC] fix wrong pointer type return from CreateSecStartEnd() to [NFC][SanitizerCoverage] fix wrong pointer type return from CreateSecStartEnd().Nov 3 2022, 6:47 PM
yingcong-wu edited the summary of this revision. (Show Details)Nov 3 2022, 10:33 PM
MaskRay accepted this revision.Nov 9 2022, 11:23 PM

This is correct. The test control-flow.ll incorrectly mixes ptr with typed pointers so the issue is not found. At this point I don't think this is more value adding typed pointer tests...

This revision is now accepted and ready to land.Nov 9 2022, 11:23 PM
MaskRay retitled this revision from [NFC][SanitizerCoverage] fix wrong pointer type return from CreateSecStartEnd() to [SanitizerCoverage] Fix wrong pointer type return from CreateSecStartEnd().Nov 9 2022, 11:24 PM