This is an archive of the discontinued LLVM Phabricator instance.

[scudo] Untag BlockEnd in reallocate
ClosedPublic

Authored by vitalybuka on Jun 30 2021, 8:33 PM.

Details

Summary

If we get here from reallocate, BlockEnd is tagged. Then we
will storeTag(UntaggedEnd) into the header of the next chunk.

Luckily header tag is 0 so unpatched code still works.

Diff Detail

Event Timeline

vitalybuka requested review of this revision.Jun 30 2021, 8:33 PM
vitalybuka created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJun 30 2021, 8:33 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
vitalybuka edited the summary of this revision. (Show Details)Jun 30 2021, 8:39 PM
vitalybuka edited the summary of this revision. (Show Details)Jul 1 2021, 11:58 AM
pcc added a comment.Jul 1 2021, 12:04 PM

Can we untag BlockEnd in reallocate instead?

Can we untag BlockEnd in reallocate instead?

Yes, but it looks a little bit inconsistent when untag End here

Can we untag BlockEnd in reallocate instead?

Yes, but it looks a little bit inconsistent when untag End here

I can change to make both arguments of storeEndMarker must be untagged

pcc added a comment.Jul 1 2021, 12:15 PM

Can we untag BlockEnd in reallocate instead?

Yes, but it looks a little bit inconsistent when untag End here

That's because they are different pointers. End refers to chunks (tagged) and BlockEnd refers to blocks (untagged).

I can change to make both arguments of storeEndMarker must be untagged

That's not going to work, we may need to store the original tag in this function.

Can we untag BlockEnd in reallocate instead?

Yes, but it looks a little bit inconsistent when untag End here

That's because they are different pointers. End refers to chunks (tagged) and BlockEnd refers to blocks (untagged).

Sure, if it does not bother you, I'll update this way.

I can change to make both arguments of storeEndMarker must be untagged

That's not going to work, we may need to store the original tag in this function.

Oh, I see.

untag in reallocate

vitalybuka retitled this revision from [scudo] Untag BlockEnd in storeEndMarker to [scudo] Untag BlockEnd in reallocate.Jul 1 2021, 12:29 PM
pcc added inline comments.Jul 1 2021, 12:36 PM
compiler-rt/lib/scudo/standalone/combined.h
1156–1157

No need to rename, we don't have both kinds of pointers in this function so no need for a long name to distinguish. The DCHECK you added below is documentation enough.

vitalybuka marked an inline comment as done.

no rename

pcc accepted this revision.Jul 1 2021, 12:55 PM

LGTM

This revision is now accepted and ready to land.Jul 1 2021, 12:55 PM
This revision was landed with ongoing or failed builds.Jul 1 2021, 1:03 PM
This revision was automatically updated to reflect the committed changes.