Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions tcmalloc/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,10 @@ enum class AllocationAccess {
switch (GetMemoryTag(ptr)) {
case MemoryTag::kNormalP1:
return 1;
case MemoryTag::kSampledOrColdP1:
// Only sampled allocations of security partition 1 under kFull heap
// partitioning are tagged kSampledOrColdP1.
return 1;
default:
return 0;
}
Expand Down
12 changes: 10 additions & 2 deletions tcmalloc/testing/partitioning_test_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,16 @@ int main() {
absl::PrintF("sampled_0_tag:%s\n", sampled_0_tag);
absl::PrintF("sampled_1_tag:%s\n", sampled_1_tag);

free(sampled_0);
free(sampled_1);
// realloc() keeps the security partition of the old pointer.
void* realloc_0 = realloc(sampled_0, 64);
void* realloc_1 = realloc(sampled_1, 64);
absl::PrintF("realloc_sampled_0_tag:%s\n",
MemoryTagToLabel(GetMemoryTag(realloc_0)));
absl::PrintF("realloc_sampled_1_tag:%s\n",
MemoryTagToLabel(GetMemoryTag(realloc_1)));

free(realloc_0);
free(realloc_1);
}

return 0;
Expand Down
Loading