This is an archive of the discontinued LLVM Phabricator instance.

[scudo][standalone] Fix some primary tests
ClosedPublic

Authored by cryptoad on Sep 28 2020, 5:21 PM.

Details

Summary

The ReleaseToOS test was flaking on Fuchsia for non-obvious reasons,
and only for ASan variants (the release was returning 0).

It turned out that the templating was off, true being promoted to
a s32 and used as the minimum interval argument. This meant that in
some circumstances, the normal release would occur, and the forced
release would have nothing to release, hence the 0 byte released.

The symbols are giving it away (note the 1):

scudo::SizeClassAllocator64<scudo::FixedSizeClassMap<scudo::DefaultSizeClassConfig>,24ul,1,2147483647,false>::releaseToOS(void)

This also probably means that there was no MTE version of that test!

Diff Detail

Event Timeline

cryptoad created this revision.Sep 28 2020, 5:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 28 2020, 5:21 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
cryptoad requested review of this revision.Sep 28 2020, 5:21 PM
cryptoad updated this revision to Diff 294841.

Actually fix all the instances of this issue :/

cryptoad retitled this revision from [scudo][standalone] Fix Primary's ReleaseToOS test to [scudo][standalone] Fix some primary tests.Sep 28 2020, 5:25 PM
cryptoad edited the summary of this revision. (Show Details)
pcc accepted this revision.Sep 28 2020, 5:28 PM

LGTM

This revision is now accepted and ready to land.Sep 28 2020, 5:28 PM
Harbormaster completed remote builds in B73252: Diff 294841.
This revision was landed with ongoing or failed builds.Sep 29 2020, 8:27 AM
This revision was automatically updated to reflect the committed changes.

Two possible approaches to make this kind of problem less likely to come up again:

  1. don't default the template args. might be annoying for this template.
  2. replace bool with an enum class NamedForPurpose bool : { kThis = false, kThat = true }; in the template argument type
pcc added a comment.Sep 29 2020, 11:44 AM

I'm not really a fan of long lists of template arguments. So I would favor something like

  1. Have the SizeClassAllocator classes take something like a Config type (see allocator_config.h) as a template argument and have it read the configuration out of that.
In D88457#2301551, @pcc wrote:

I'm not really a fan of long lists of template arguments. So I would favor something like

  1. Have the SizeClassAllocator classes take something like a Config type (see allocator_config.h) as a template argument and have it read the configuration out of that.

I like this as well, also because it keep symbols shorter and easier to read.