[all-commits] [llvm/llvm-project] c7b2d9: [sancov] Introduce optional callback for stack-dep...

Kees Cook via All-commits all-commits at lists.llvm.org
Wed May 7 05:41:45 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c7b2d98c934c9578dd880370905b5abafdeccbe3
      https://github.com/llvm/llvm-project/commit/c7b2d98c934c9578dd880370905b5abafdeccbe3
  Author: Kees Cook <kees at kernel.org>
  Date:   2025-05-07 (Wed, 07 May 2025)

  Changed paths:
    M clang/docs/SanitizerCoverage.rst
    M clang/include/clang/Basic/CodeGenOptions.def
    M clang/include/clang/Driver/Options.td
    M clang/include/clang/Driver/SanitizerArgs.h
    M clang/lib/CodeGen/BackendUtil.cpp
    M clang/lib/Driver/SanitizerArgs.cpp
    M clang/test/Driver/fsanitize-coverage.c
    M llvm/include/llvm/Transforms/Utils/Instrumentation.h
    M llvm/lib/Transforms/Instrumentation/SanitizerCoverage.cpp
    A llvm/test/Instrumentation/SanitizerCoverage/stack-depth-callback.ll

  Log Message:
  -----------
  [sancov] Introduce optional callback for stack-depth tracking (#138323)

Normally -fsanitize-coverage=stack-depth inserts inline arithmetic to
update thread_local __sancov_lowest_stack. To support stack depth
tracking in the Linux kernel, which does not implement traditional
thread_local storage, provide the option to call a function instead.

This matches the existing "stackleak" implementation that is supported
in Linux via a GCC plugin. To make this coverage more performant, a
minimum estimated stack depth can be chosen to enable the callback mode,
skipping instrumentation of functions with smaller stacks.

With -fsanitize-coverage-stack-depth-callback-min set greater than 0,
the __sanitize_cov_stack_depth() callback will be injected when the
estimated stack depth is greater than or equal to the given minimum.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list