[all-commits] [llvm/llvm-project] bd5b77: __asan_register_elf_globals: properly check the "n...

Fangrui Song via All-commits all-commits at lists.llvm.org
Tue Jun 25 13:15:00 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bd5b77529f07d21c27cf14009845e319e454867d
      https://github.com/llvm/llvm-project/commit/bd5b77529f07d21c27cf14009845e319e454867d
  Author: Fangrui Song <i at maskray.me>
  Date:   2024-06-25 (Tue, 25 Jun 2024)

  Changed paths:
    M compiler-rt/lib/asan/asan_globals.cpp

  Log Message:
  -----------
  __asan_register_elf_globals: properly check the "no instrumented global variable" case

On ELF platforms, the instrumentation registers global variables using
`__asan_register_elf_globals` for the default `UseGlobalsGC` case. If
all instrumented global variables in a module are discarded by linker
GC, we will have `start == stop`.

Normally `start == 0`, but `start != 0` is possible with a linker script
retaining `asan_globals`. The called `__asan_register_globals` would
access out-of-bounds `globals[n-1]`, though there is likely no runtime
failure.

Pull Request: https://github.com/llvm/llvm-project/pull/96529



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