Changeset 220708 in webkit


Ignore:
Timestamp:
Aug 14, 2017 10:44:35 AM (7 years ago)
Author:
Jonathan Bedard
Message:

sub-categorize Sandbox violation logs
https://bugs.webkit.org/show_bug.cgi?id=175536
<rdar://problem/33834416>

Reviewed by David Kilzer.

  • Scripts/webkitpy/common/system/crashlogs.py:

(CrashLogs._parse_darwin_crash_log): Add 'Sandbox-' to the log name if the log is
a Sandbox violation.
(CrashLogs._find_all_logs_darwin): Update comment.

  • Scripts/webkitpy/common/system/crashlogs_unittest.py:

(make_mock_sandbox_report_darwin): Create a Sandbox violation log for testing.
(CrashLogsTest.create_crash_logs_darwin): Add Sandbox violation to list of crashes.
(CrashLogsTest.test_find_all_log_darwin): 8 logs in testing instead of 7.
(CrashLogsTest.test_duplicate_log_darwin): Check for Sandbox violation log.

  • Scripts/webkitpy/port/darwin.py:

(DarwinPort._merge_crash_logs): Handle Sandbox violation case.

Location:
trunk/Tools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r220705 r220708  
     12017-08-14  Jonathan Bedard  <jbedard@apple.com>
     2
     3        sub-categorize Sandbox violation logs
     4        https://bugs.webkit.org/show_bug.cgi?id=175536
     5        <rdar://problem/33834416>
     6
     7        Reviewed by David Kilzer.
     8
     9        * Scripts/webkitpy/common/system/crashlogs.py:
     10        (CrashLogs._parse_darwin_crash_log): Add 'Sandbox-' to the log name if the log is
     11        a Sandbox violation.
     12        (CrashLogs._find_all_logs_darwin): Update comment.
     13        * Scripts/webkitpy/common/system/crashlogs_unittest.py:
     14        (make_mock_sandbox_report_darwin): Create a Sandbox violation log for testing.
     15        (CrashLogsTest.create_crash_logs_darwin): Add Sandbox violation to list of crashes.
     16        (CrashLogsTest.test_find_all_log_darwin): 8 logs in testing instead of 7.
     17        (CrashLogsTest.test_duplicate_log_darwin): Check for Sandbox violation log.
     18        * Scripts/webkitpy/port/darwin.py:
     19        (DarwinPort._merge_crash_logs): Handle Sandbox violation case.
     20
    1212017-08-14  Daniel Bates  <dabates@apple.com>
    222
  • trunk/Tools/Scripts/webkitpy/common/system/crashlogs.py

    r219088 r220708  
    6363        if not contents:
    6464            return (None, None, None)
     65        is_sandbox_violation = False
    6566        for line in contents.splitlines():
     67            if line.startswith('Sandbox Violation:'):
     68                is_sandbox_violation = True
    6669            match = CrashLogs.DARWIN_PROCESS_REGEX.match(line)
    6770            if match:
    68                 return (match.group('process_name'), int(match.group('pid')), contents)
     71                return (('Sandbox-' if is_sandbox_violation else '') + match.group('process_name'), int(match.group('pid')), contents)
    6972        return (None, None, contents)
    7073
     
    164167                    # Processes can remain running after Sandbox violations, which generate crash logs.
    165168                    # This means that we can have mutliple crash logs attributed to the same process.
    166                     # The unique_name must be named in the format PROCESS_NAME-PID-#, where '-#' is optional.
    167                     # This is because of how DarwinPort._merge_crash_logs parses the crash name.
     169                    # The unique_name must be named in the format PROCESS_NAME-PID-# or Sandbox-PROCESS_NAME-PID-#,
     170                    # where '-#' is optional. This is because of how DarwinPort._merge_crash_logs parses the crash name.
    168171                    count = 1
    169172                    unique_name = result_name
  • trunk/Tools/Scripts/webkitpy/common/system/crashlogs_unittest.py

    r219088 r220708  
    7171PCI Card: NVIDIA GeForce GT 120, sppci_displaycontroller, MXM-Slot
    7272Serial ATA Device: OPTIARC DVD RW AD-5670S
     73""".format(process_name=process_name, pid=pid)
     74
     75
     76def make_mock_sandbox_report_darwin(process_name, pid):
     77    return """Incident Identifier: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
     78CrashReporter Key:   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
     79Report Type:         187
     80Sandbox Violation:   Sandbox: {process_name}({pid})
     81
     82{process_name}[{pid}] sandboxed.
     83size = 2513
     84container = <none>
     85sb_refcount = 2
     86profile = {process_name}
     87profile_refcount = 5
     88profile variables:
     89    HOME -> 1
     90    FRONT_USER_HOME -> 0
     91    PROCESS_TEMP_DIR -> 2
     92
     93Process:         {process_name} [{pid}]
     94Path:            /some/path/{process_name}
     95Load Address:    0x100c98000
     96Identifier:      {process_name}
     97Version:         xxxx.x.x (xxxx)
     98Code Type:       arm64 (Native)
     99Parent Process:  launchd.development [1]
     100User ID:         xxx
     101
     102Date/Time:       2017-08-09 13:46:21.203 PDT
     103OS Version:      iOS 10.0 (14xxxx)
     104Report Version:  104
     105
     106Thread 0 (id: xxxxxx):
     1070   libsystem_kernel.dylib              0x0000000182a91dbc
     1081   libsystem_pthread.dylib             0x0000000182ba2fb0
     1092   libsystem_pthread.dylib             0x0000000182ba2c30
     110
     111Binary Images:
     112       0x182a70000 -        0x182a97fff  libsystem_kernel.dylib arm64 <1e5e0578f0db37e7bfa493945180cfcd> /usr/lib/system/libsystem_kernel.dylib
    73113""".format(process_name=process_name, pid=pid)
    74114
     
    244284
    245285        self.older_mock_crash_report = make_mock_crash_report_darwin('DumpRenderTree', 28528)
     286        self.sandbox_crash_report = make_mock_sandbox_report_darwin('DumpRenderTree', 28530)
    246287        self.mock_crash_report = make_mock_crash_report_darwin('DumpRenderTree', 28530)
    247288        self.newer_mock_crash_report = make_mock_crash_report_darwin('DumpRenderTree', 28529)
     
    249290        self.misformatted_mock_crash_report = 'Junk that should not appear in a crash report' + make_mock_crash_report_darwin('DumpRenderTree', 28526)[200:]
    250291        self.files = {}
    251         self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150716_quadzen.crash'] = self.older_mock_crash_report
    252         self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150717_quadzen_1.crash'] = self.older_mock_crash_report
    253         self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150718_quadzen_2.crash'] = self.older_mock_crash_report
     292        self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150715_quadzen.crash'] = self.older_mock_crash_report
     293        self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150716_quadzen_1.crash'] = self.older_mock_crash_report
     294        self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150717_quadzen_2.crash'] = self.older_mock_crash_report
     295        self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150718_quadzen.crash'] = self.sandbox_crash_report
    254296        self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150719_quadzen.crash'] = self.mock_crash_report
    255297        self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150720_quadzen.crash'] = self.newer_mock_crash_report
     
    270312        crash_logs = self.create_crash_logs_darwin()
    271313        all_logs = crash_logs.find_all_logs()
    272         self.assertEqual(len(all_logs), 7)
     314        self.assertEqual(len(all_logs), 8)
    273315
    274316        for test, crash_log in all_logs.iteritems():
    275317            self.assertTrue(crash_log in self.files.values())
    276             self.assertTrue(test == "Unknown" or int(test.split("-")[1]) in range(28527, 28531))
     318            if test.split('-')[0] != 'Sandbox':
     319                self.assertTrue(test == "Unknown" or int(test.split("-")[1]) in range(28527, 28531))
    277320
    278321    def test_duplicate_log_darwin(self):
     
    282325        crash_logs = self.create_crash_logs_darwin()
    283326        all_logs = crash_logs.find_all_logs()
    284         expected_logs = ['DumpRenderTree-28528', 'DumpRenderTree-28528-1', 'DumpRenderTree-28528-2',
     327        expected_logs = ['DumpRenderTree-28528', 'DumpRenderTree-28528-1', 'DumpRenderTree-28528-2', 'Sandbox-DumpRenderTree-28530',
    285328                         'DumpRenderTree-28529', 'DumpRenderTree-28530', 'FooProcess-28527', 'Unknown']
    286329
  • trunk/Tools/Scripts/webkitpy/port/darwin.py

    r217946 r220708  
    9898        for test, crash_log in new_logs.iteritems():
    9999            try:
    100                 process_name = test.split("-")[0]
    101                 pid = int(test.split("-")[1])
     100                if test.split('-')[0] == 'Sandbox':
     101                    process_name = test.split('-')[1]
     102                    pid = int(test.split('-')[2])
     103                else:
     104                    process_name = test.split('-')[0]
     105                    pid = int(test.split('-')[1])
    102106            except IndexError:
    103107                continue
Note: See TracChangeset for help on using the changeset viewer.