Title: [220708] trunk/Tools
Revision
220708
Author
[email protected]
Date
2017-08-14 10:44:35 -0700 (Mon, 14 Aug 2017)

Log 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.

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (220707 => 220708)


--- trunk/Tools/ChangeLog	2017-08-14 17:42:09 UTC (rev 220707)
+++ trunk/Tools/ChangeLog	2017-08-14 17:44:35 UTC (rev 220708)
@@ -1,3 +1,23 @@
+2017-08-14  Jonathan Bedard  <[email protected]>
+
+        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.
+
 2017-08-14  Daniel Bates  <[email protected]>
 
         Add Automator service to copy permalink to Clipboard

Modified: trunk/Tools/Scripts/webkitpy/common/system/crashlogs.py (220707 => 220708)


--- trunk/Tools/Scripts/webkitpy/common/system/crashlogs.py	2017-08-14 17:42:09 UTC (rev 220707)
+++ trunk/Tools/Scripts/webkitpy/common/system/crashlogs.py	2017-08-14 17:44:35 UTC (rev 220708)
@@ -62,10 +62,13 @@
         contents = self._host.symbolicate_crash_log_if_needed(path)
         if not contents:
             return (None, None, None)
+        is_sandbox_violation = False
         for line in contents.splitlines():
+            if line.startswith('Sandbox Violation:'):
+                is_sandbox_violation = True
             match = CrashLogs.DARWIN_PROCESS_REGEX.match(line)
             if match:
-                return (match.group('process_name'), int(match.group('pid')), contents)
+                return (('Sandbox-' if is_sandbox_violation else '') + match.group('process_name'), int(match.group('pid')), contents)
         return (None, None, contents)
 
     def _find_newest_log_darwin(self, process_name, pid, include_errors, newer_than):
@@ -163,8 +166,8 @@
 
                     # Processes can remain running after Sandbox violations, which generate crash logs.
                     # This means that we can have mutliple crash logs attributed to the same process.
-                    # The unique_name must be named in the format PROCESS_NAME-PID-#, where '-#' is optional.
-                    # This is because of how DarwinPort._merge_crash_logs parses the crash name.
+                    # The unique_name must be named in the format PROCESS_NAME-PID-# or Sandbox-PROCESS_NAME-PID-#,
+                    # where '-#' is optional. This is because of how DarwinPort._merge_crash_logs parses the crash name.
                     count = 1
                     unique_name = result_name
                     while unique_name in crash_logs:

Modified: trunk/Tools/Scripts/webkitpy/common/system/crashlogs_unittest.py (220707 => 220708)


--- trunk/Tools/Scripts/webkitpy/common/system/crashlogs_unittest.py	2017-08-14 17:42:09 UTC (rev 220707)
+++ trunk/Tools/Scripts/webkitpy/common/system/crashlogs_unittest.py	2017-08-14 17:44:35 UTC (rev 220708)
@@ -73,6 +73,46 @@
 """.format(process_name=process_name, pid=pid)
 
 
+def make_mock_sandbox_report_darwin(process_name, pid):
+    return """Incident Identifier: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
+CrashReporter Key:   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
+Report Type:         187
+Sandbox Violation:   Sandbox: {process_name}({pid})
+
+{process_name}[{pid}] sandboxed.
+size = 2513
+container = <none>
+sb_refcount = 2
+profile = ""
+profile_refcount = 5
+profile variables:
+    HOME -> 1
+    FRONT_USER_HOME -> 0
+    PROCESS_TEMP_DIR -> 2
+
+Process:         {process_name} [{pid}]
+Path:            /some/path/{process_name}
+Load Address:    0x100c98000
+Identifier:      {process_name}
+Version:         xxxx.x.x (xxxx)
+Code Type:       arm64 (Native)
+Parent Process:  launchd.development [1]
+User ID:         xxx
+
+Date/Time:       2017-08-09 13:46:21.203 PDT
+OS Version:      iOS 10.0 (14xxxx)
+Report Version:  104
+
+Thread 0 (id: xxxxxx):
+0   libsystem_kernel.dylib        	0x0000000182a91dbc
+1   libsystem_pthread.dylib       	0x0000000182ba2fb0
+2   libsystem_pthread.dylib       	0x0000000182ba2c30
+
+Binary Images:
+       0x182a70000 -        0x182a97fff  libsystem_kernel.dylib arm64 <1e5e0578f0db37e7bfa493945180cfcd> /usr/lib/system/libsystem_kernel.dylib
+""".format(process_name=process_name, pid=pid)
+
+
 def make_mock_crash_report_win(process_name, pid):
     return """Opened log file 'C:\Projects\WebKit\OpenSource\WebKitBuild\Release\bin32\layout-test-results\CrashLog_1d58_2013-06-03_12-21-20-110.txt'
 0:000> .srcpath "C:\Projects\WebKit\OpenSource"
@@ -243,14 +283,16 @@
             return
 
         self.older_mock_crash_report = make_mock_crash_report_darwin('DumpRenderTree', 28528)
+        self.sandbox_crash_report = make_mock_sandbox_report_darwin('DumpRenderTree', 28530)
         self.mock_crash_report = make_mock_crash_report_darwin('DumpRenderTree', 28530)
         self.newer_mock_crash_report = make_mock_crash_report_darwin('DumpRenderTree', 28529)
         self.other_process_mock_crash_report = make_mock_crash_report_darwin('FooProcess', 28527)
         self.misformatted_mock_crash_report = 'Junk that should not appear in a crash report' + make_mock_crash_report_darwin('DumpRenderTree', 28526)[200:]
         self.files = {}
-        self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150716_quadzen.crash'] = self.older_mock_crash_report
-        self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150717_quadzen_1.crash'] = self.older_mock_crash_report
-        self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150718_quadzen_2.crash'] = self.older_mock_crash_report
+        self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150715_quadzen.crash'] = self.older_mock_crash_report
+        self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150716_quadzen_1.crash'] = self.older_mock_crash_report
+        self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150717_quadzen_2.crash'] = self.older_mock_crash_report
+        self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150718_quadzen.crash'] = self.sandbox_crash_report
         self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150719_quadzen.crash'] = self.mock_crash_report
         self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150720_quadzen.crash'] = self.newer_mock_crash_report
         self.files['/Users/mock/Library/Logs/DiagnosticReports/DumpRenderTree_2011-06-13-150721_quadzen.crash'] = None
@@ -269,11 +311,12 @@
 
         crash_logs = self.create_crash_logs_darwin()
         all_logs = crash_logs.find_all_logs()
-        self.assertEqual(len(all_logs), 7)
+        self.assertEqual(len(all_logs), 8)
 
         for test, crash_log in all_logs.iteritems():
             self.assertTrue(crash_log in self.files.values())
-            self.assertTrue(test == "Unknown" or int(test.split("-")[1]) in range(28527, 28531))
+            if test.split('-')[0] != 'Sandbox':
+                self.assertTrue(test == "Unknown" or int(test.split("-")[1]) in range(28527, 28531))
 
     def test_duplicate_log_darwin(self):
         if not SystemHost().platform.is_mac():
@@ -281,7 +324,7 @@
 
         crash_logs = self.create_crash_logs_darwin()
         all_logs = crash_logs.find_all_logs()
-        expected_logs = ['DumpRenderTree-28528', 'DumpRenderTree-28528-1', 'DumpRenderTree-28528-2',
+        expected_logs = ['DumpRenderTree-28528', 'DumpRenderTree-28528-1', 'DumpRenderTree-28528-2', 'Sandbox-DumpRenderTree-28530',
                          'DumpRenderTree-28529', 'DumpRenderTree-28530', 'FooProcess-28527', 'Unknown']
 
         for log in expected_logs:

Modified: trunk/Tools/Scripts/webkitpy/port/darwin.py (220707 => 220708)


--- trunk/Tools/Scripts/webkitpy/port/darwin.py	2017-08-14 17:42:09 UTC (rev 220707)
+++ trunk/Tools/Scripts/webkitpy/port/darwin.py	2017-08-14 17:44:35 UTC (rev 220708)
@@ -97,8 +97,12 @@
     def _merge_crash_logs(self, logs, new_logs, crashed_processes):
         for test, crash_log in new_logs.iteritems():
             try:
-                process_name = test.split("-")[0]
-                pid = int(test.split("-")[1])
+                if test.split('-')[0] == 'Sandbox':
+                    process_name = test.split('-')[1]
+                    pid = int(test.split('-')[2])
+                else:
+                    process_name = test.split('-')[0]
+                    pid = int(test.split('-')[1])
             except IndexError:
                 continue
             if not any(entry[1] == process_name and entry[2] == pid for entry in crashed_processes):
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to