Beispiel #1
0
def filter_stacktrace(crash_stacktrace, crash_type, revisions_dict, platform,
                      job_type):
    """Clean up and format a stack trace for display."""
    if not crash_stacktrace:
        return ''

    # Truncate stacktrace if it's too big.
    crash_stacktrace = _truncate_stacktrace(crash_stacktrace)

    filtered_crash_lines = []
    for line in crash_stacktrace.splitlines():
        # Html escape line content to prevent XSS.
        line = html.escape(line, quote=True)
        line = source_mapper.linkify_stack_frame(line, revisions_dict)

        if 'android' in platform or environment.is_lkl_job(job_type):
            line = _linkify_android_kernel_stack_frame_if_needed(line)

        filtered_crash_lines.append(line)

    filtered_crash_stacktrace = '\n'.join(filtered_crash_lines)

    if crash_type == leak_blacklist.DIRECT_LEAK_LABEL:
        return leak_blacklist.highlight_first_direct_leak(
            filtered_crash_stacktrace)

    return highlight_common_stack_frames(filtered_crash_stacktrace)
def linkify_kernel_or_lkl_stacktrace_if_needed(crash_info):
    """Linkify Android Kernel or lkl stacktrace."""
    kernel_prefix = ''
    kernel_hash = ''
    if (environment.is_android_kernel()
            and not environment.is_android_cuttlefish() and
        (crash_info.found_android_kernel_crash or crash_info.is_kasan)):
        kernel_prefix, kernel_hash = \
          android_kernel.get_kernel_prefix_and_full_hash()

    elif (environment.is_lkl_job() and crash_info.is_lkl
          and crash_info.lkl_kernel_build_id):
        kernel_prefix, kernel_hash = \
          lkl_kernel.get_kernel_prefix_and_full_hash(crash_info.lkl_kernel_build_id)

    if kernel_prefix and kernel_hash:
        _linkify_android_kernel_stacktrace(crash_info, kernel_prefix,
                                           kernel_hash)
Beispiel #3
0
def filter_binary_path(binary_path):
  """Filters binary path to provide a local copy."""
  if environment.is_android() or environment.is_lkl_job():
    return symbols_downloader.filter_binary_path(binary_path)

  if environment.platform() == 'CHROMEOS':
    # FIXME: Add code to pull binaries from ChromeOS device.
    return binary_path

  if environment.is_chromeos_system_job():
    # This conditional is True for ChromeOS system fuzzers that are running on
    # Linux. Ensure that the binary is always looked for in the chroot and not
    # in system directories.
    build_dir = environment.get_value('BUILD_DIR')
    if not binary_path.startswith(build_dir):
      # Fixup path so |binary_path| points to a binary in the chroot (probably
      # a system library).
      return os.path.join(build_dir, binary_path[1:])

  # For Linux and Mac, the binary exists locally. No work to do,
  # just return the same binary path.
  return binary_path
Beispiel #4
0
def is_lkl_stack_trace(unsymbolized_crash_stacktrace):
  """Is this an lkl stack trace?"""
  return (
      environment.is_lkl_job() and
      constants.LINUX_KERNEL_MODULE_STACK_TRACE in unsymbolized_crash_stacktrace
  )