| OLD | NEW |
| 1 // Copyright 2013 Google Inc. All Rights Reserved. | 1 // Copyright 2013 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 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1306 // Class created to enable parametrization of the tests with Clang. | 1306 // Class created to enable parametrization of the tests with Clang. |
| 1307 // Currently only Syzygy is supported but will be extended to work with CLANG. | 1307 // Currently only Syzygy is supported but will be extended to work with CLANG. |
| 1308 // Right now it just forwards the calls to the parent class. | 1308 // Right now it just forwards the calls to the parent class. |
| 1309 class ParametrizedLenientInstrumentAppIntegrationTest | 1309 class ParametrizedLenientInstrumentAppIntegrationTest |
| 1310 : public LenientInstrumentAppIntegrationTest, | 1310 : public LenientInstrumentAppIntegrationTest, |
| 1311 public ::testing::WithParamInterface<InstrumentationMode> { | 1311 public ::testing::WithParamInterface<InstrumentationMode> { |
| 1312 public: | 1312 public: |
| 1313 void EndToEndTest(const std::string& mode) override { | 1313 void EndToEndTest(const std::string& mode) override { |
| 1314 if (GetParam() == SYZYGY) { | 1314 if (GetParam() == SYZYGY) { |
| 1315 LenientInstrumentAppIntegrationTest::EndToEndTest(mode); | 1315 LenientInstrumentAppIntegrationTest::EndToEndTest(mode); |
| 1316 } else if (GetParam() == CLANG) { |
| 1317 test_dll_path_ = |
| 1318 testing::GetExeRelativePath(testing::kIntegrationTestsClangDllName); |
| 1319 // Validates that the test dll loads post instrumentation. |
| 1320 ASSERT_NO_FATAL_FAILURE(LoadTestDll(test_dll_path_, &module_)); |
| 1316 } | 1321 } |
| 1317 } | 1322 } |
| 1318 | 1323 |
| 1319 void EndToEndCheckTestDll() override { | 1324 void EndToEndCheckTestDll() override { |
| 1320 if (GetParam() == SYZYGY) { | 1325 if (GetParam() == SYZYGY) { |
| 1321 LenientInstrumentAppIntegrationTest::EndToEndCheckTestDll(); | 1326 LenientInstrumentAppIntegrationTest::EndToEndCheckTestDll(); |
| 1322 } | 1327 } |
| 1323 } | 1328 } |
| 1324 }; | 1329 }; |
| 1325 | 1330 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1452 // Disable the heap checking as this is implies touching all the shadow bytes | 1457 // Disable the heap checking as this is implies touching all the shadow bytes |
| 1453 // and this make those tests really slow. | 1458 // and this make those tests really slow. |
| 1454 AddEnvironmentChange(::common::kSyzyAsanOptionsEnvVar, | 1459 AddEnvironmentChange(::common::kSyzyAsanOptionsEnvVar, |
| 1455 "--no_check_heap_on_failure"); | 1460 "--no_check_heap_on_failure"); |
| 1456 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1461 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1457 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1462 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1458 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); | 1463 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); |
| 1459 ASSERT_NO_FATAL_FAILURE(CheckTestDllImportsRedirected()); | 1464 ASSERT_NO_FATAL_FAILURE(CheckTestDllImportsRedirected()); |
| 1460 } | 1465 } |
| 1461 | 1466 |
| 1462 TEST_P(ParametrizedInstrumentAppIntegrationTest, AsanEndToEndNoLiveness) { | |
| 1463 // Disable the heap checking as this is implies touching all the shadow bytes | |
| 1464 // and this make those tests really slow. | |
| 1465 AddEnvironmentChange(::common::kSyzyAsanOptionsEnvVar, | |
| 1466 "--no_check_heap_on_failure"); | |
| 1467 cmd_line_.AppendSwitch("no-liveness-analysis"); | |
| 1468 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | |
| 1469 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | |
| 1470 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); | |
| 1471 } | |
| 1472 | |
| 1473 TEST_P(ParametrizedInstrumentAppIntegrationTest, | |
| 1474 AsanEndToEndNoRedundancyAnalysis) { | |
| 1475 // Disable the heap checking as this is implies touching all the shadow bytes | |
| 1476 // and this make those tests really slow. | |
| 1477 AddEnvironmentChange(::common::kSyzyAsanOptionsEnvVar, | |
| 1478 "--no_check_heap_on_failure"); | |
| 1479 cmd_line_.AppendSwitch("no-redundancy-analysis"); | |
| 1480 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | |
| 1481 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | |
| 1482 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); | |
| 1483 } | |
| 1484 | |
| 1485 TEST_P(ParametrizedInstrumentAppIntegrationTest, | |
| 1486 AsanEndToEndNoFunctionInterceptors) { | |
| 1487 // Disable the heap checking as this is implies touching all the shadow bytes | |
| 1488 // and this make those tests really slow. | |
| 1489 AddEnvironmentChange(::common::kSyzyAsanOptionsEnvVar, | |
| 1490 "--no_check_heap_on_failure"); | |
| 1491 cmd_line_.AppendSwitch("no-interceptors"); | |
| 1492 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | |
| 1493 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | |
| 1494 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); | |
| 1495 } | |
| 1496 | |
| 1497 TEST_P(ParametrizedInstrumentAppIntegrationTest, AsanEndToEndWithRtlOptions) { | 1467 TEST_P(ParametrizedInstrumentAppIntegrationTest, AsanEndToEndWithRtlOptions) { |
| 1498 cmd_line_.AppendSwitchASCII( | 1468 AddEnvironmentChange( |
| 1499 common::kAsanRtlOptions, | 1469 ::common::kSyzyAsanOptionsEnvVar, |
| 1500 "--quarantine_size=20000000 --quarantine_block_size=1000000 " | 1470 "--quarantine_size=20000000 --quarantine_block_size=1000000 " |
| 1501 "--no_check_heap_on_failure"); | 1471 "--no_check_heap_on_failure"); |
| 1502 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1472 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1503 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1473 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1504 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); | 1474 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); |
| 1505 | 1475 |
| 1506 // Get the active runtime and validate its parameters. | 1476 // Get the active runtime and validate its parameters. |
| 1507 agent::asan::AsanRuntime* runtime = GetActiveAsanRuntime(); | 1477 agent::asan::AsanRuntime* runtime = GetActiveAsanRuntime(); |
| 1508 ASSERT_TRUE(runtime != NULL); | 1478 ASSERT_TRUE(runtime != NULL); |
| 1509 ASSERT_EQ(20000000u, runtime->params().quarantine_size); | 1479 ASSERT_EQ(20000000u, runtime->params().quarantine_size); |
| 1510 ASSERT_EQ(1000000u, runtime->params().quarantine_block_size); | 1480 ASSERT_EQ(1000000u, runtime->params().quarantine_block_size); |
| 1511 } | 1481 } |
| 1512 | 1482 |
| 1513 TEST_P(ParametrizedInstrumentAppIntegrationTest, | 1483 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| 1514 AsanEndToEndWithRtlOptionsOverrideWithEnvironment) { | |
| 1515 std::unique_ptr<base::Environment> env(base::Environment::Create()); | |
| 1516 ASSERT_NE(env.get(), nullptr); | |
| 1517 env->SetVar(::common::kSyzyAsanOptionsEnvVar, | |
| 1518 "--quarantine_block_size=800000 --ignored_stack_ids=0x1 " | |
| 1519 "--no_check_heap_on_failure"); | |
| 1520 cmd_line_.AppendSwitchASCII( | |
| 1521 common::kAsanRtlOptions, | |
| 1522 "--quarantine_size=20000000 --quarantine_block_size=1000000 " | |
| 1523 "--ignored_stack_ids=0x2"); | |
| 1524 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | |
| 1525 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | |
| 1526 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); | |
| 1527 | |
| 1528 // Get the active runtime and validate its parameters. | |
| 1529 agent::asan::AsanRuntime* runtime = GetActiveAsanRuntime(); | |
| 1530 ASSERT_TRUE(runtime != NULL); | |
| 1531 ASSERT_EQ(20000000u, runtime->params().quarantine_size); | |
| 1532 ASSERT_EQ(800000u, runtime->params().quarantine_block_size); | |
| 1533 ASSERT_THAT(runtime->params().ignored_stack_ids_set, | |
| 1534 testing::ElementsAre(0x1, 0x2)); | |
| 1535 | |
| 1536 env->UnSetVar(::common::kSyzyAsanOptionsEnvVar); | |
| 1537 } | |
| 1538 | |
| 1539 TEST_P(ParametrizedInstrumentAppIntegrationTest, FullOptimizedAsanEndToEnd) { | |
| 1540 // Disable the heap checking as this implies touching all the shadow bytes | |
| 1541 // and this make these tests really slow. | |
| 1542 AddEnvironmentChange(::common::kSyzyAsanOptionsEnvVar, | |
| 1543 "--no_check_heap_on_failure"); | |
| 1544 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | |
| 1545 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | |
| 1546 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); | |
| 1547 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckInterceptedFunctions()); | |
| 1548 } | |
| 1549 | |
| 1550 TEST_P(ParametrizedInstrumentAppIntegrationTest, | |
| 1551 AsanInvalidAccessWithCorruptAllocatedBlockHeader) { | 1484 AsanInvalidAccessWithCorruptAllocatedBlockHeader) { |
| 1552 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1485 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1553 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1486 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1487 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); |
| 1554 OutOfProcessAsanErrorCheckAndValidateLog( | 1488 OutOfProcessAsanErrorCheckAndValidateLog( |
| 1555 testing::kAsanInvalidAccessWithCorruptAllocatedBlockHeader, true, | 1489 testing::kAsanInvalidAccessWithCorruptAllocatedBlockHeader, true, |
| 1556 kAsanCorruptHeap, NULL); | 1490 kAsanCorruptHeap, NULL); |
| 1557 } | 1491 } |
| 1558 | 1492 |
| 1559 TEST_P(ParametrizedInstrumentAppIntegrationTest, | 1493 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| 1560 AsanOverflowCallsCrashForException) { | 1494 AsanOverflowCallsCrashForException) { |
| 1561 // Asan-detected violations go through CrashForException if it is available. | 1495 // Asan-detected violations go through CrashForException if it is available. |
| 1562 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1496 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1563 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1497 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1589 AsanCorruptBlockWithPageProtections) { | 1523 AsanCorruptBlockWithPageProtections) { |
| 1590 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1524 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1591 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1525 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1592 OutOfProcessAsanErrorCheckAndValidateLog( | 1526 OutOfProcessAsanErrorCheckAndValidateLog( |
| 1593 testing::kAsanCorruptBlockWithPageProtections, true, | 1527 testing::kAsanCorruptBlockWithPageProtections, true, |
| 1594 kAsanHeapUseAfterFree, kAsanCorruptHeap); | 1528 kAsanHeapUseAfterFree, kAsanCorruptHeap); |
| 1595 } | 1529 } |
| 1596 | 1530 |
| 1597 TEST_P(ParametrizedInstrumentAppIntegrationTest, | 1531 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| 1598 SampledAllocationsAsanEndToEnd) { | 1532 SampledAllocationsAsanEndToEnd) { |
| 1599 cmd_line_.AppendSwitchASCII("asan-rtl-options", | 1533 AddEnvironmentChange(::common::kSyzyAsanOptionsEnvVar, |
| 1600 "--allocation_guard_rate=0.5 " | 1534 "--allocation_guard_rate=0.5 " |
| 1601 "--no_check_heap_on_failure"); | 1535 "--no_check_heap_on_failure"); |
| 1602 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1536 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1603 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1537 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1604 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckSampledAllocations()); | 1538 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckSampledAllocations()); |
| 1605 } | 1539 } |
| 1606 | 1540 |
| 1607 TEST_P(ParametrizedInstrumentAppIntegrationTest, | 1541 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| 1608 AsanLargeBlockHeapEnabledTest) { | 1542 AsanLargeBlockHeapEnabledTest) { |
| 1609 cmd_line_.AppendSwitchASCII("asan-rtl-options", | 1543 AddEnvironmentChange(::common::kSyzyAsanOptionsEnvVar, |
| 1610 "--no_check_heap_on_failure " | 1544 "--no_check_heap_on_failure " |
| 1611 "--quarantine_size=4000000 " | 1545 "--quarantine_size=4000000 " |
| 1612 "--quarantine_block_size=2000000"); | 1546 "--quarantine_block_size=2000000"); |
| 1613 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1547 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1614 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1548 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1615 ASSERT_NO_FATAL_FAILURE(AsanLargeBlockHeapTests(true)); | 1549 ASSERT_NO_FATAL_FAILURE(AsanLargeBlockHeapTests(true)); |
| 1616 } | 1550 } |
| 1617 | 1551 |
| 1618 TEST_P(ParametrizedInstrumentAppIntegrationTest, | 1552 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| 1619 AsanLargeBlockHeapDisabledTest) { | 1553 AsanLargeBlockHeapDisabledTest) { |
| 1620 cmd_line_.AppendSwitchASCII("asan-rtl-options", | 1554 AddEnvironmentChange(::common::kSyzyAsanOptionsEnvVar, |
| 1621 "--no_check_heap_on_failure " | 1555 "--no_check_heap_on_failure " |
| 1622 "--disable_large_block_heap"); | 1556 "--disable_large_block_heap"); |
| 1623 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1557 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1624 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1558 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1625 ASSERT_NO_FATAL_FAILURE(AsanLargeBlockHeapTests(false)); | 1559 ASSERT_NO_FATAL_FAILURE(AsanLargeBlockHeapTests(false)); |
| 1626 } | 1560 } |
| 1627 | 1561 |
| 1628 TEST_P(ParametrizedInstrumentAppIntegrationTest, AsanZebraHeapDisabledTest) { | |
| 1629 AsanZebraHeapTest(false); | |
| 1630 } | |
| 1631 | |
| 1632 TEST_P(ParametrizedInstrumentAppIntegrationTest, AsanZebraHeapEnabledTest) { | |
| 1633 AsanZebraHeapTest(true); | |
| 1634 } | |
| 1635 | |
| 1636 TEST_P(ParametrizedInstrumentAppIntegrationTest, | 1562 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| 1637 AsanSymbolizerTestAsanBufferOverflow) { | 1563 AsanSymbolizerTestAsanBufferOverflow) { |
| 1638 AsanSymbolizerTest(testing::kAsanRead8BufferOverflow, | 1564 AsanSymbolizerTest(testing::kAsanRead8BufferOverflow, |
| 1639 STRINGIFY(HEAP_BUFFER_OVERFLOW), | 1565 STRINGIFY(HEAP_BUFFER_OVERFLOW), |
| 1640 STRINGIFY(ASAN_READ_ACCESS), | 1566 STRINGIFY(ASAN_READ_ACCESS), |
| 1641 1, | 1567 1, |
| 1642 false); | 1568 false); |
| 1643 } | 1569 } |
| 1644 | 1570 |
| 1645 TEST_P(ParametrizedInstrumentAppIntegrationTest, | 1571 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1662 | 1588 |
| 1663 TEST_P(ParametrizedInstrumentAppIntegrationTest, | 1589 TEST_P(ParametrizedInstrumentAppIntegrationTest, |
| 1664 AsanSymbolizerTestAsanCorruptBlock) { | 1590 AsanSymbolizerTestAsanCorruptBlock) { |
| 1665 AsanSymbolizerTest(testing::kAsanCorruptBlock, | 1591 AsanSymbolizerTest(testing::kAsanCorruptBlock, |
| 1666 STRINGIFY(CORRUPT_BLOCK), | 1592 STRINGIFY(CORRUPT_BLOCK), |
| 1667 STRINGIFY(ASAN_UNKNOWN_ACCESS), | 1593 STRINGIFY(ASAN_UNKNOWN_ACCESS), |
| 1668 0, | 1594 0, |
| 1669 false); | 1595 false); |
| 1670 } | 1596 } |
| 1671 | 1597 |
| 1672 TEST_P(ParametrizedInstrumentAppIntegrationTest, | |
| 1673 AsanSymbolizerTestAsanCorruptBlockInQuarantine) { | |
| 1674 AsanSymbolizerTest(testing::kAsanCorruptBlockInQuarantine, | |
| 1675 STRINGIFY(CORRUPT_BLOCK), | |
| 1676 STRINGIFY(ASAN_UNKNOWN_ACCESS), | |
| 1677 0, | |
| 1678 true); | |
| 1679 } | |
| 1680 | |
| 1681 // These tests require corrupt heap checking to be enabled. | 1598 // These tests require corrupt heap checking to be enabled. |
| 1682 TEST_P(ParametrizedInstrumentAppIntegrationTest, AsanNearNullptrAccess) { | 1599 TEST_P(ParametrizedInstrumentAppIntegrationTest, AsanNearNullptrAccess) { |
| 1683 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1600 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1684 | 1601 |
| 1685 OutOfProcessAsanErrorCheckAndValidateLog( | 1602 OutOfProcessAsanErrorCheckAndValidateLog( |
| 1686 testing::kAsanNearNullptrAccessHeapCorruptionInstrumented, true, | 1603 testing::kAsanNearNullptrAccessHeapCorruptionInstrumented, true, |
| 1687 kAsanHandlingException, kAsanNearNullptrAccessHeapCorruption); | 1604 kAsanHandlingException, kAsanNearNullptrAccessHeapCorruption); |
| 1688 OutOfProcessAsanErrorCheckAndValidateLog( | 1605 OutOfProcessAsanErrorCheckAndValidateLog( |
| 1689 testing::kAsanNearNullptrAccessHeapCorruptionUninstrumented, true, | 1606 testing::kAsanNearNullptrAccessHeapCorruptionUninstrumented, true, |
| 1690 kAsanHandlingException, kAsanNearNullptrAccessHeapCorruption); | 1607 kAsanHandlingException, kAsanNearNullptrAccessHeapCorruption); |
| 1691 OutOfProcessAsanErrorCheckAndValidateLog( | 1608 OutOfProcessAsanErrorCheckAndValidateLog( |
| 1692 testing::kAsanNearNullptrAccessNoHeapCorruptionInstrumented, true, | 1609 testing::kAsanNearNullptrAccessNoHeapCorruptionInstrumented, true, |
| 1693 kAsanHandlingException, kAsanNearNullptrAccessNoHeapCorruption); | 1610 kAsanHandlingException, kAsanNearNullptrAccessNoHeapCorruption); |
| 1694 OutOfProcessAsanErrorCheckAndValidateLog( | 1611 OutOfProcessAsanErrorCheckAndValidateLog( |
| 1695 testing::kAsanNearNullptrAccessNoHeapCorruptionUninstrumented, true, | 1612 testing::kAsanNearNullptrAccessNoHeapCorruptionUninstrumented, true, |
| 1696 kAsanHandlingException, kAsanNearNullptrAccessNoHeapCorruption); | 1613 kAsanHandlingException, kAsanNearNullptrAccessNoHeapCorruption); |
| 1697 OutOfProcessAsanErrorCheckAndValidateLog( | 1614 OutOfProcessAsanErrorCheckAndValidateLog( |
| 1698 testing::kAsanNullptrAccessNoHeapCorruptionUninstrumented, true, | 1615 testing::kAsanNullptrAccessNoHeapCorruptionUninstrumented, true, |
| 1699 kAsanHandlingException, kAsanNearNullptrAccessNoHeapCorruption); | 1616 kAsanHandlingException, kAsanNearNullptrAccessNoHeapCorruption); |
| 1700 } | 1617 } |
| 1701 | 1618 |
| 1702 // Instantiate the test cases only with SYZYGY until some problems are fixed. | |
| 1703 INSTANTIATE_TEST_CASE_P(InstantiationName, | 1619 INSTANTIATE_TEST_CASE_P(InstantiationName, |
| 1704 ParametrizedInstrumentAppIntegrationTest, | 1620 ParametrizedInstrumentAppIntegrationTest, |
| 1705 testing::Values(SYZYGY)); | 1621 testing::Values(SYZYGY, CLANG)); |
| 1622 |
| 1623 TEST_F(InstrumentAppIntegrationTest, AsanEndToEndNoLiveness) { |
| 1624 // Disable the heap checking as this is implies touching all the shadow bytes |
| 1625 // and this make those tests really slow. |
| 1626 AddEnvironmentChange(::common::kSyzyAsanOptionsEnvVar, |
| 1627 "--no_check_heap_on_failure"); |
| 1628 cmd_line_.AppendSwitch("no-liveness-analysis"); |
| 1629 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1630 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1631 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); |
| 1632 } |
| 1633 |
| 1634 TEST_F(InstrumentAppIntegrationTest, AsanEndToEndNoRedundancyAnalysis) { |
| 1635 // Disable the heap checking as this is implies touching all the shadow bytes |
| 1636 // and this make those tests really slow. |
| 1637 AddEnvironmentChange(::common::kSyzyAsanOptionsEnvVar, |
| 1638 "--no_check_heap_on_failure"); |
| 1639 cmd_line_.AppendSwitch("no-redundancy-analysis"); |
| 1640 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1641 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1642 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); |
| 1643 } |
| 1644 |
| 1645 TEST_F(InstrumentAppIntegrationTest, AsanEndToEndNoFunctionInterceptors) { |
| 1646 // Disable the heap checking as this is implies touching all the shadow bytes |
| 1647 // and this make those tests really slow. |
| 1648 AddEnvironmentChange(::common::kSyzyAsanOptionsEnvVar, |
| 1649 "--no_check_heap_on_failure"); |
| 1650 cmd_line_.AppendSwitch("no-interceptors"); |
| 1651 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1652 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1653 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); |
| 1654 } |
| 1655 |
| 1656 TEST_F(InstrumentAppIntegrationTest, |
| 1657 AsanEndToEndWithRtlOptionsOverrideWithEnvironment) { |
| 1658 std::unique_ptr<base::Environment> env(base::Environment::Create()); |
| 1659 ASSERT_NE(env.get(), nullptr); |
| 1660 env->SetVar(::common::kSyzyAsanOptionsEnvVar, |
| 1661 "--quarantine_block_size=800000 --ignored_stack_ids=0x1 " |
| 1662 "--no_check_heap_on_failure"); |
| 1663 cmd_line_.AppendSwitchASCII( |
| 1664 common::kAsanRtlOptions, |
| 1665 "--quarantine_size=20000000 --quarantine_block_size=1000000 " |
| 1666 "--ignored_stack_ids=0x2"); |
| 1667 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1668 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1669 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); |
| 1670 |
| 1671 // Get the active runtime and validate its parameters. |
| 1672 agent::asan::AsanRuntime* runtime = GetActiveAsanRuntime(); |
| 1673 ASSERT_TRUE(runtime != NULL); |
| 1674 ASSERT_EQ(20000000u, runtime->params().quarantine_size); |
| 1675 ASSERT_EQ(800000u, runtime->params().quarantine_block_size); |
| 1676 ASSERT_THAT(runtime->params().ignored_stack_ids_set, |
| 1677 testing::ElementsAre(0x1, 0x2)); |
| 1678 |
| 1679 env->UnSetVar(::common::kSyzyAsanOptionsEnvVar); |
| 1680 } |
| 1681 |
| 1682 TEST_F(InstrumentAppIntegrationTest, FullOptimizedAsanEndToEnd) { |
| 1683 // Disable the heap checking as this implies touching all the shadow bytes |
| 1684 // and this make these tests really slow. |
| 1685 AddEnvironmentChange(::common::kSyzyAsanOptionsEnvVar, |
| 1686 "--no_check_heap_on_failure"); |
| 1687 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1688 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1689 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckTestDll()); |
| 1690 ASSERT_NO_FATAL_FAILURE(AsanErrorCheckInterceptedFunctions()); |
| 1691 } |
| 1692 |
| 1693 TEST_F(InstrumentAppIntegrationTest, |
| 1694 AsanSymbolizerTestAsanCorruptBlockInQuarantine) { |
| 1695 // This test requires the HeapCreate/HeapDestroy functions to be intercepted |
| 1696 // and thus doesn't work on a Clang instrumented binary. |
| 1697 AsanSymbolizerTest(testing::kAsanCorruptBlockInQuarantine, |
| 1698 STRINGIFY(CORRUPT_BLOCK), STRINGIFY(ASAN_UNKNOWN_ACCESS), |
| 1699 0, true); |
| 1700 } |
| 1701 |
| 1702 TEST_F(InstrumentAppIntegrationTest, AsanZebraHeapDisabledTest) { |
| 1703 AsanZebraHeapTest(false); |
| 1704 } |
| 1705 |
| 1706 TEST_F(InstrumentAppIntegrationTest, AsanZebraHeapEnabledTest) { |
| 1707 AsanZebraHeapTest(true); |
| 1708 } |
| 1706 | 1709 |
| 1707 TEST_F(InstrumentAppIntegrationTest, BBEntryEndToEnd) { | 1710 TEST_F(InstrumentAppIntegrationTest, BBEntryEndToEnd) { |
| 1708 ASSERT_NO_FATAL_FAILURE(StartService()); | 1711 ASSERT_NO_FATAL_FAILURE(StartService()); |
| 1709 ASSERT_NO_FATAL_FAILURE(EndToEndTest("bbentry")); | 1712 ASSERT_NO_FATAL_FAILURE(EndToEndTest("bbentry")); |
| 1710 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); | 1713 ASSERT_NO_FATAL_FAILURE(EndToEndCheckTestDll()); |
| 1711 ASSERT_NO_FATAL_FAILURE(BBEntryInvokeTestDll()); | 1714 ASSERT_NO_FATAL_FAILURE(BBEntryInvokeTestDll()); |
| 1712 ASSERT_NO_FATAL_FAILURE(StopService()); | 1715 ASSERT_NO_FATAL_FAILURE(StopService()); |
| 1713 ASSERT_NO_FATAL_FAILURE(BBEntryCheckTestDll()); | 1716 ASSERT_NO_FATAL_FAILURE(BBEntryCheckTestDll()); |
| 1714 } | 1717 } |
| 1715 | 1718 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1805 | 1808 |
| 1806 TEST_F(InstrumentAppIntegrationTest, DeferredFreeTLS) { | 1809 TEST_F(InstrumentAppIntegrationTest, DeferredFreeTLS) { |
| 1807 ASSERT_NO_FATAL_FAILURE(StartService()); | 1810 ASSERT_NO_FATAL_FAILURE(StartService()); |
| 1808 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); | 1811 ASSERT_NO_FATAL_FAILURE(EndToEndTest("asan")); |
| 1809 ASSERT_EQ(0, InvokeTestDllFunction(testing::kAsanDeferredFreeTLS)); | 1812 ASSERT_EQ(0, InvokeTestDllFunction(testing::kAsanDeferredFreeTLS)); |
| 1810 ASSERT_NO_FATAL_FAILURE(UnloadDll()); | 1813 ASSERT_NO_FATAL_FAILURE(UnloadDll()); |
| 1811 ASSERT_NO_FATAL_FAILURE(StopService()); | 1814 ASSERT_NO_FATAL_FAILURE(StopService()); |
| 1812 } | 1815 } |
| 1813 | 1816 |
| 1814 } // namespace integration_tests | 1817 } // namespace integration_tests |
| OLD | NEW |