[all-commits] [llvm/llvm-project] 866ee2: [KernelAddressSanitizer] Make globals constructors...

Marco Elver via All-commits all-commits at lists.llvm.org
Fri Jun 5 11:27:11 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 866ee2353f7d0224644799d0d1faed53c7f3a06d
      https://github.com/llvm/llvm-project/commit/866ee2353f7d0224644799d0d1faed53c7f3a06d
  Author: Marco Elver <elver at google.com>
  Date:   2020-06-05 (Fri, 05 Jun 2020)

  Changed paths:
    M clang/test/CodeGen/asan-globals.cpp
    M llvm/include/llvm/Transforms/Utils/ModuleUtils.h
    M llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
    M llvm/lib/Transforms/Utils/ModuleUtils.cpp

  Log Message:
  -----------
  [KernelAddressSanitizer] Make globals constructors compatible with kernel

Summary:
This makes -fsanitize=kernel-address emit the correct globals
constructors for the kernel. We had to do the following:

- Disable generation of constructors that rely on linker features such
  as dead-global elimination.

- Only emit constructors for globals *not* in explicit sections. The
  kernel uses sections for special globals, which we should not touch.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=203493

Tested:
1. With 'clang/test/CodeGen/asan-globals.cpp'.
2. With test_kasan.ko, we can see:

  	BUG: KASAN: global-out-of-bounds in kasan_global_oob+0xb3/0xba [test_kasan]

Reviewers: glider, andreyknvl

Reviewed By: glider

Subscribers: cfe-commits, nickdesaulniers, hiraditya, llvm-commits

Tags: #llvm, #clang

Differential Revision: https://reviews.llvm.org/D80805




More information about the All-commits mailing list