Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Side by Side Diff: syzygy/agent/asan/block_unittest.cc

Issue 2527533003: Make SyzyAsan support the allocation > 1GB (Closed)
Patch Set: Do an unguarded alloc if the size > 2GB Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 Google Inc. All Rights Reserved. 1 // Copyright 2014 Google Inc. All Rights Reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 EXPECT_EQ(BuildBlockLayout(8, 120, 24, 0, 64, 4, 28), layout); 185 EXPECT_EQ(BuildBlockLayout(8, 120, 24, 0, 64, 4, 28), layout);
186 186
187 EXPECT_TRUE(BlockPlanLayout(8, 8, 61, 0, 0, &layout)); 187 EXPECT_TRUE(BlockPlanLayout(8, 8, 61, 0, 0, &layout));
188 EXPECT_EQ(BuildBlockLayout(8, 120, 24, 0, 61, 7, 28), layout); 188 EXPECT_EQ(BuildBlockLayout(8, 120, 24, 0, 61, 7, 28), layout);
189 189
190 // Plan a layout that would use guard pages. 190 // Plan a layout that would use guard pages.
191 EXPECT_TRUE(BlockPlanLayout(4096, 8, 100, 4096, 4096, &layout)); 191 EXPECT_TRUE(BlockPlanLayout(4096, 8, 100, 4096, 4096, &layout));
192 EXPECT_EQ(BuildBlockLayout(4096, 3 * 4096, 24, 8064, 100, 4072, 28), layout); 192 EXPECT_EQ(BuildBlockLayout(4096, 3 * 4096, 24, 8064, 100, 4072, 28), layout);
193 #endif 193 #endif
194 194
195 // Plan a layout with an invalid size, this should fail. 195 EXPECT_TRUE(BlockPlanLayout(
196 8, 8, static_cast<uint32_t>(1 << kBlockBodySizeBits) - 1, 0, 0, &layout));
197
198 // Plan some layouts with an invalid size, this should fail.
199 EXPECT_FALSE(BlockPlanLayout(
200 8, 8, static_cast<uint32_t>(1 << kBlockBodySizeBits), 0, 0, &layout));
196 EXPECT_FALSE(BlockPlanLayout(8, 8, 0xffffffff, 0, 0, &layout)); 201 EXPECT_FALSE(BlockPlanLayout(8, 8, 0xffffffff, 0, 0, &layout));
197 } 202 }
198 203
199 TEST_F(BlockTest, EndToEnd) { 204 TEST_F(BlockTest, EndToEnd) {
200 BlockLayout layout = {}; 205 BlockLayout layout = {};
201 BlockInfo block_info = {}; 206 BlockInfo block_info = {};
202 207
203 EXPECT_TRUE(BlockPlanLayout(8, 8, 4, 0, 0, &layout)); 208 EXPECT_TRUE(BlockPlanLayout(8, 8, 4, 0, 0, &layout));
204 std::vector<uint8_t> block_data(layout.block_size); 209 std::vector<uint8_t> block_data(layout.block_size);
205 BlockInitialize(layout, block_data.data(), &block_info); 210 BlockInitialize(layout, block_data.data(), &block_info);
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 BlockBitFlipsFixChecksum(QUARANTINED_BLOCK, block1.block_info, 0)); 808 BlockBitFlipsFixChecksum(QUARANTINED_BLOCK, block1.block_info, 0));
804 EXPECT_TRUE( 809 EXPECT_TRUE(
805 BlockBitFlipsFixChecksum(QUARANTINED_BLOCK, block1.block_info, 3)); 810 BlockBitFlipsFixChecksum(QUARANTINED_BLOCK, block1.block_info, 3));
806 flips = BlockBitFlipsRequired(QUARANTINED_BLOCK, block1.block_info, 3); 811 flips = BlockBitFlipsRequired(QUARANTINED_BLOCK, block1.block_info, 3);
807 EXPECT_LT(0u, flips); 812 EXPECT_LT(0u, flips);
808 EXPECT_GE(3u, flips); 813 EXPECT_GE(3u, flips);
809 } 814 }
810 815
811 } // namespace asan 816 } // namespace asan
812 } // namespace agent 817 } // namespace agent
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698