diff --git a/tools/clang/scripts/download_lld_mac.py b/tools/clang/scripts/download_lld_mac.py index dace92d..3bb2b68 100755 --- a/tools/clang/scripts/download_lld_mac.py +++ b/tools/clang/scripts/download_lld_mac.py
@@ -20,7 +20,9 @@ if not os.path.exists(LLD_LINK_PATH): return False lld_rev = subprocess.check_output([LLD_LINK_PATH, '--version']) - return (re.match(r'LLD.*\(.*trunk (\d+)\)', lld_rev).group(1) == + # Version output example: + # LLD 9.0.0 (https://github.com/llvm/llvm-project/ 342571e8d6eb1afb151ae1103431798e3d24054f) + return (re.match(r'LLD.*\(.*git.*llvm.* ([0-9a-f]+)\)', lld_rev).group(1) == update.CLANG_REVISION)
diff --git a/tools/clang/scripts/update.py b/tools/clang/scripts/update.py index b7ec74c..876fb66d1 100755 --- a/tools/clang/scripts/update.py +++ b/tools/clang/scripts/update.py
@@ -36,9 +36,9 @@ # Do NOT CHANGE this if you don't know what you're doing -- see # https://chromium.googlesource.com/chromium/src/+/master/docs/updating_clang.md # Reverting problematic clang rolls is safe, though. -CLANG_REVISION = '342571e8d6eb1afb151ae1103431798e3d24054f' -CLANG_SVN_REVISION = '361565' -CLANG_SUB_REVISION = 1 +CLANG_REVISION = '67510fac36d27b2e22c7cd955fc167136b737b93' +CLANG_SVN_REVISION = '361212' +CLANG_SUB_REVISION = 2 PACKAGE_VERSION = '%s-%s-%s' % (CLANG_SVN_REVISION, CLANG_REVISION[:8], CLANG_SUB_REVISION)
diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index e076131..bd6332bf 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml
@@ -34498,8 +34498,10 @@ <int value="149914698" label="SearchReadyOmnibox:disabled"/> <int value="151022756" label="ArcAvailableForChildAccount:disabled"/> <int value="151101719" label="HtmlBaseUsernameDetector:enabled"/> + <int value="153347646" label="SmartDimModelV3:disabled"/> <int value="157217034" label="enable-tab-for-desktop-share"/> <int value="157318016" label="AutomaticTabDiscarding:enabled"/> + <int value="160838658" label="SmartDimModelV3:enabled"/> <int value="161409456" label="AutofillUseMobileLabelDisambiguation:disabled"/> <int value="161694478" label="OmniboxNewAnswerLayout:enabled"/> <int value="173288154" label="PrintPdfAsImage:enabled"/> @@ -58373,6 +58375,14 @@ <int value="64" label=".gdoc"/> <int value="65" label=".gsheet"/> <int value="66" label=".gslides"/> + <int value="67" label=".arw"/> + <int value="68" label=".cr2"/> + <int value="69" label=".dng"/> + <int value="70" label=".nef"/> + <int value="71" label=".nrw"/> + <int value="72" label=".orf"/> + <int value="73" label=".raf"/> + <int value="74" label=".rw2"/> </enum> <enum name="VirtualKeyboardContainerType">
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 670a6a3e..e0f8b08a 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml
@@ -10834,6 +10834,28 @@ </summary> </histogram> +<histogram name="AutoScreenBrightness.ModelTraining.Inaccuracy.NoUpdate" + units="%" expires_after="2019-12-31"> + <owner>jiameng@chromium.org</owner> + <owner>napper@chromium.org</owner> + <summary> + When training data comes in, the model may or may not be updated. We measure + the error of the model as compared with the target value from training data. + This metric measures the error when model is not updated. Chrome OS only. + </summary> +</histogram> + +<histogram name="AutoScreenBrightness.ModelTraining.Inaccuracy.Update" + units="%" expires_after="2019-12-31"> + <owner>jiameng@chromium.org</owner> + <owner>napper@chromium.org</owner> + <summary> + When training data comes in, the model may or may not be updated. We measure + the error of the model as compared with the target value from training data. + This metric measures the error when model is updated. Chrome OS only. + </summary> +</histogram> + <histogram name="AutoScreenBrightness.ModelTraining.ModelUserConsistent" enum="Boolean" expires_after="2019-12-31"> <owner>jiameng@chromium.org</owner> @@ -136444,7 +136466,8 @@ </summary> </histogram> -<histogram name="V8.GCBackgroundScavenger" units="ms" expires_after="M77"> +<histogram name="V8.GCBackgroundScavenger" units="ms" + expires_after="2020-06-01"> <owner>ulan@chromium.org</owner> <summary> Time spent in background tasks doing scavenging in one GC cycle. It is @@ -136452,7 +136475,7 @@ </summary> </histogram> -<histogram name="V8.GCBackgroundSweeping" units="ms" expires_after="M77"> +<histogram name="V8.GCBackgroundSweeping" units="ms" expires_after="2020-06-01"> <owner>ulan@chromium.org</owner> <summary> Time spent in background tasks doing sweeping in one GC cycle. It is @@ -136465,21 +136488,23 @@ <summary>Time spent in mark-sweep phase of GC.</summary> </histogram> -<histogram name="V8.GCCompactorBackground" units="ms" expires_after="M77"> +<histogram name="V8.GCCompactorBackground" units="ms" + expires_after="2020-06-01"> <owner>hpayer@chromium.org</owner> <summary> Time spent in mark-sweep phase of GC in a background isolate. </summary> </histogram> -<histogram name="V8.GCCompactorForeground" units="ms" expires_after="M77"> +<histogram name="V8.GCCompactorForeground" units="ms" + expires_after="2020-06-01"> <owner>hpayer@chromium.org</owner> <summary> Time spent in mark-sweep phase of GC in a foreground isolate. </summary> </histogram> -<histogram name="V8.GCContext" units="ms" expires_after="M77"> +<histogram name="V8.GCContext" units="ms" expires_after="2020-06-01"> <owner>hpayer@chromium.org</owner> <summary>Time spent doing a full GC during an IdleNotification.</summary> </histogram> @@ -136493,7 +136518,7 @@ </summary> </histogram> -<histogram name="V8.GCFinalizeMC.Clear" units="ms" expires_after="M77"> +<histogram name="V8.GCFinalizeMC.Clear" units="ms" expires_after="2020-06-01"> <owner>ulan@chromium.org</owner> <owner>hpayer@chromium.org</owner> <summary> @@ -136502,7 +136527,8 @@ </summary> </histogram> -<histogram name="V8.GCFinalizeMC.Epilogue" units="ms" expires_after="M77"> +<histogram name="V8.GCFinalizeMC.Epilogue" units="ms" + expires_after="2020-06-01"> <owner>ulan@chromium.org</owner> <owner>hpayer@chromium.org</owner> <summary> @@ -136510,7 +136536,8 @@ </summary> </histogram> -<histogram name="V8.GCFinalizeMC.Evacuate" units="ms" expires_after="M77"> +<histogram name="V8.GCFinalizeMC.Evacuate" units="ms" + expires_after="2020-06-01"> <owner>ulan@chromium.org</owner> <owner>hpayer@chromium.org</owner> <summary> @@ -136519,7 +136546,7 @@ </summary> </histogram> -<histogram name="V8.GCFinalizeMC.Finish" units="ms" expires_after="M77"> +<histogram name="V8.GCFinalizeMC.Finish" units="ms" expires_after="2020-06-01"> <owner>ulan@chromium.org</owner> <owner>hpayer@chromium.org</owner> <summary> @@ -136528,7 +136555,7 @@ </summary> </histogram> -<histogram name="V8.GCFinalizeMC.Mark" units="ms"> +<histogram name="V8.GCFinalizeMC.Mark" units="ms" expires_after="2020-06-01"> <owner>ulan@chromium.org</owner> <owner>hpayer@chromium.org</owner> <summary> @@ -136537,7 +136564,8 @@ </summary> </histogram> -<histogram name="V8.GCFinalizeMC.Prologue" units="ms" expires_after="M77"> +<histogram name="V8.GCFinalizeMC.Prologue" units="ms" + expires_after="2020-06-01"> <owner>ulan@chromium.org</owner> <owner>hpayer@chromium.org</owner> <summary> @@ -136545,7 +136573,7 @@ </summary> </histogram> -<histogram name="V8.GCFinalizeMC.Sweep" units="ms" expires_after="M77"> +<histogram name="V8.GCFinalizeMC.Sweep" units="ms" expires_after="2020-06-01"> <owner>ulan@chromium.org</owner> <owner>hpayer@chromium.org</owner> <summary> @@ -136554,7 +136582,8 @@ </summary> </histogram> -<histogram name="V8.GCFinalizeMCBackground" units="ms" expires_after="M77"> +<histogram name="V8.GCFinalizeMCBackground" units="ms" + expires_after="2020-06-01"> <owner>ulan@chromium.org</owner> <owner>hpayer@chromium.org</owner> <summary> @@ -136582,7 +136611,7 @@ </histogram> <histogram name="V8.GCFinalizeMCReduceMemoryBackground" units="ms" - expires_after="M77"> + expires_after="2020-06-01"> <owner>ulan@chromium.org</owner> <owner>hpayer@chromium.org</owner> <summary> @@ -136592,7 +136621,7 @@ </histogram> <histogram name="V8.GCFinalizeMCReduceMemoryForeground" units="ms" - expires_after="M77"> + expires_after="2020-06-01"> <owner>ulan@chromium.org</owner> <owner>hpayer@chromium.org</owner> <summary> @@ -136601,7 +136630,7 @@ </summary> </histogram> -<histogram name="V8.GCIdleNotification" units="ms" expires_after="M77"> +<histogram name="V8.GCIdleNotification" units="ms" expires_after="2020-06-01"> <owner>hpayer@chromium.org</owner> <summary>Time spent in IdleNotifications.</summary> </histogram> @@ -136637,13 +136666,13 @@ </summary> </histogram> -<histogram name="V8.GCIncrementalMarking" units="ms" expires_after="M77"> +<histogram name="V8.GCIncrementalMarking" units="ms" expires_after="2020-06-01"> <owner>hpayer@chromium.org</owner> <summary>Time spent doing incremental marking steps during GC.</summary> </histogram> <histogram name="V8.GCIncrementalMarkingFinalize" units="ms" - expires_after="M77"> + expires_after="2020-06-01"> <owner>hpayer@chromium.org</owner> <summary>Time spent in finalizing incremental marking.</summary> </histogram> @@ -136653,7 +136682,8 @@ <summary>Reason an incremental marking was started in V8.</summary> </histogram> -<histogram name="V8.GCIncrementalMarkingStart" units="ms" expires_after="M77"> +<histogram name="V8.GCIncrementalMarkingStart" units="ms" + expires_after="2020-06-01"> <owner>hpayer@chromium.org</owner> <summary>Time spent in starting incremental marking.</summary> </histogram> @@ -136666,7 +136696,8 @@ </summary> </histogram> -<histogram name="V8.GCLowMemoryNotification" units="ms" expires_after="M77"> +<histogram name="V8.GCLowMemoryNotification" units="ms" + expires_after="2020-06-01"> <owner>hpayer@chromium.org</owner> <summary>Time spent in LowMemoryNotifications.</summary> </histogram> @@ -136696,7 +136727,7 @@ <summary>Reason a mark-compact garbage collection was started in V8.</summary> </histogram> -<histogram name="V8.GCMarkingSum" units="ms" expires_after="2020-04-01"> +<histogram name="V8.GCMarkingSum" units="ms" expires_after="2020-06-01"> <owner>mlippautz@chromium.org</owner> <summary> Sum of all durations of all marking phases (incremental and non-incremental) @@ -136718,12 +136749,14 @@ </summary> </histogram> -<histogram name="V8.GCScavenger.ScavengeRoots" units="ms" expires_after="M77"> +<histogram name="V8.GCScavenger.ScavengeRoots" units="ms" + expires_after="2020-06-01"> <owner>mlippautz@chromium.org</owner> <summary>Time spent in scavenging the roots during a V8 scavenge.</summary> </histogram> -<histogram name="V8.GCScavengerBackground" units="ms" expires_after="M77"> +<histogram name="V8.GCScavengerBackground" units="ms" + expires_after="2020-06-01"> <owner>hpayer@chromium.org</owner> <summary> Time spent in scavenging phase of GC in a background isolate. @@ -136731,7 +136764,7 @@ </histogram> <histogram name="V8.GCScavengeReason" enum="GarbageCollectionReason" - expires_after="M77"> + expires_after="2020-06-01"> <owner>ulan@chromium.org</owner> <summary>Reason a scavenge garbage collection was started in V8.</summary> </histogram> @@ -136781,7 +136814,7 @@ </histogram> <histogram name="V8.MemoryExternalFragmentationLoSpace" units="%" - expires_after="M77"> + expires_after="2020-06-01"> <owner>hpayer@chromium.org</owner> <summary> External memory fragmentation in the large object space after each GC in
diff --git a/tools/wayland_aux/Makefile b/tools/wayland_aux/Makefile index 91f9017..56a9fc7 100644 --- a/tools/wayland_aux/Makefile +++ b/tools/wayland_aux/Makefile
@@ -1,9 +1,12 @@ THIS_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) XDGSHELL := $(THIS_DIR)/../../third_party/wayland-protocols/src/unstable/xdg-shell/xdg-shell-unstable-v6.xml $(wildcard *.py) -all: x.in.svg x.de.svg l.in.svg l.de.svg +all: x.in.svg x.de.svg l.in.svg l.de.svg fuzz_actions.proto @echo $(XDG_SHELL) +fuzz_actions.proto: $(XDGSHELL) + python main.py --spec $< -t proto > $@ + %.in.svg: %.in.gv fdp -Tsvg $< -o $@ @@ -25,3 +28,4 @@ clean: rm -f *.svg *.gv rm -rf __pycache__ + rm -f fuzz_actions.proto
diff --git a/tools/wayland_aux/main.py b/tools/wayland_aux/main.py index 9152a00..70aebc1 100644 --- a/tools/wayland_aux/main.py +++ b/tools/wayland_aux/main.py
@@ -12,6 +12,7 @@ import sys import xml.etree.ElementTree as xml import gv_diagram +import proto_gen def strip_protocol(protocol): @@ -41,7 +42,8 @@ nargs='+', required=True) parser.add_argument('-t', '--type', help='Output different types of graph', - choices=['interfaces', 'deps'], required=True) + choices=['interfaces', 'deps', + 'harness', 'proto'], required=True) parser.add_argument('-x', '--extra', help='add extra detail to the normal printout', action='store_true') @@ -50,11 +52,15 @@ protocols = [strip_protocol(read_protocol(path)) for path in parsed.spec] extra = parsed.extra if parsed.type == 'deps': - drawer = gv_diagram.DepsPrinter(extra) + gv_diagram.DepsPrinter(extra).draw(protocols) + elif parsed.type == 'interfaces': + gv_diagram.InterfacesPrinter(extra).draw(protocols) + elif parsed.type == 'harness': + pass + elif parsed.type == 'proto': + proto_gen.generate(protocols) else: - drawer = gv_diagram.InterfacesPrinter(extra) - - drawer.draw(protocols) + raise Exception('%s not implemented' % parsed.type) if __name__ == '__main__':
diff --git a/tools/wayland_aux/proto_gen.py b/tools/wayland_aux/proto_gen.py new file mode 100644 index 0000000..1fddc628 --- /dev/null +++ b/tools/wayland_aux/proto_gen.py
@@ -0,0 +1,121 @@ +# Copyright (c) 2019 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Generates a protobuf for fuzzing purposes. + +Use the generate() function to print a protobuf file, which allows libfuzzer to +fuzz the given protocols.. +""" + +from __future__ import absolute_import +from __future__ import print_function +import protocol_util + + +class Generator(object): + """Base class for generating something from a list of protocols. + + Provides several utilities for generating files of things from a list of + protocols. + """ + + def out(self, text): + print(text) + + def generate(self, protocols): + pass + + +proto_type_conversions = { + 'object': 'uint32', + 'int': 'int32', + 'uint': 'uint32', + 'string': 'string', + 'fd': 'uint32', +} + + +class ProtoGenerator(Generator): + """Generate a libfuzzable protobuf. + + Creates a protobuf for use when fuzzing wayland. This protobuf defines all the + client-side messages which the fuzzer might call. + """ + + def named(self, *args): + return '_'.join((e.attrib['name'] for e in args)) + + def get_type(self, ty): + if ty in proto_type_conversions: + return proto_type_conversions[ty] + raise Exception('unknown conversion for type: ' + ty) + + def generate_action(self, name, args): + self.out('message %s {' % name) + for (idx, (a_type, a_name)) in enumerate([('uint32', 'receiver')] + args): + self.out('required %s %s = %d;'%(a_type, a_name, idx+1)) + self.out('}') + + def generate_req_action(self, ptc, ifc, msg): + """Generate an action protobuf message. + + Args: + ptc: the <protocol> xml element. + ifc: the <interface> xml element. + msg: the <request> xml element (given that <event>s don't need messages). + """ + args = [] + name = self.named(ptc, ifc, msg) + if name == 'wayland_wl_registry_bind': + args = [('global', 'global'), ('uint32', 'name'), ('uint32', 'version')] + else: + args = [(self.get_type(arg.attrib['type']), arg.attrib['name']) + for arg in msg.findall('arg') + if arg.attrib['type'] != 'new_id'] + if protocol_util.is_constructor(msg): + c_type = protocol_util.get_constructed(msg) + self.out('// Constructs %s' % (c_type if c_type else '???')) + self.generate_action(name, args) + + def generate(self, protocols): + self.out('syntax = "proto2";') + self.out('package = exo.wayland_fuzzer;') + + # Make the globals enum for identifying globals to bind. + self.out('enum global {') + self.out('GLOBAL_UNSPECIFIED=0;') + for (idx, (pro, ifc)) in enumerate(protocol_util.get_globals(protocols)): + self.out('%s = %d;'%(self.named(pro, ifc), idx+1)) + self.out('}') + + # List all the possible actions. + self.out('message actions {') + self.out('repeated action acts = 1;') + self.out('}') + self.out('message action {') + self.out('oneof act {') + actions = ['meta_dispatch', 'meta_roundtrip'] + [ + self.named(p, i, m) + for (p, i, m) in protocol_util.all_messages(protocols) + if protocol_util.is_request(m)] + for (idx, act) in enumerate(actions): + self.out('%s act_%s = %d;' % (act, act, idx+1)) + self.out('}') + self.out('}') + self.generate_action('meta_dispatch', []) + self.generate_action('meta_roundtrip', []) + for (p, i, m) in protocol_util.all_messages(protocols): + if protocol_util.is_request(m): + self.generate_req_action(p, i, m) + + +def generate(protocols): + """Make a protobuf for fuzzing the |protocols|. + + Args: + protocols: a list of xml.etree.ElementTree.Element where each element is a + wayland <protocol> node. This list will be converted to a protobuf file + that can be used for fuzzing. + """ + ProtoGenerator().generate(protocols)
diff --git a/tools/wayland_aux/protocol_util.py b/tools/wayland_aux/protocol_util.py index 83b9012..59d886e 100644 --- a/tools/wayland_aux/protocol_util.py +++ b/tools/wayland_aux/protocol_util.py
@@ -25,6 +25,14 @@ yield r +def is_event(message): + return message.tag == 'event' + + +def is_request(message): + return message.tag == 'request' + + def is_constructor(message): """Check if a message is a constructor. @@ -50,3 +58,67 @@ """ return 'type' in message.attrib and message.attrib['type'] == 'destructor' + +def all_interfaces(protocols): + """Get the interfaces in these protocols. + + Args: + protocols: the list of protocols you want the interfaces of. + + Yields: + Tuples (p, i) of (p)rotocol (i)nterface. + """ + for p in protocols: + for i in p.findall('interface'): + yield (p, i) + + +def all_messages(protocols): + """Get the messages in these protocols. + + Args: + protocols: the list of protocols you want the messages of. + + Yields: + Tuples (p, i, m) of (p)rotocol, (i)nterface, and (m)essage. + """ + for (p, i) in all_interfaces(protocols): + for m in grab_interface_messages(i): + yield (p, i, m) + + +def get_constructed(message): + """Gets the interface constructed by a message. + + Note that even if is_constructor(message) returns true, get_constructed can + still return None when the message constructs an unknown interface (e.g. + wl_registry.bind()). + + Args: + message: the message which may be a constructor. + + Returns: + The name of the constructed interface (if there is one), or None. + """ + for arg in message.findall('arg'): + if 'type' in arg.attrib and arg.attrib['type'] == 'new_id': + return arg.attrib.get('interface', None) + return None + + +def get_globals(protocols): + """List all of the global interfaces (i.e. those without a constructor). + + Args: + protocols: the list of protocols you want the globals for. + + Yields: + Tuples (p, i) of (p)rotocol, (i)nterface, where the interface is a global. + """ + non_globals = set(get_constructed(m) + for (p, i, m) in all_messages(protocols) + if get_constructed(m)) + for (p, i) in all_interfaces(protocols): + if i.attrib['name'] not in non_globals: + yield (p, i) +