[all-commits] [llvm/llvm-project] 45f6d5: [DFSan] Change shadow and origin memory layouts to...

Andrew Browne via All-commits all-commits at lists.llvm.org
Fri Jun 25 17:01:32 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 45f6d5522f8d9b6439a40885ed30ad898089a2cd
      https://github.com/llvm/llvm-project/commit/45f6d5522f8d9b6439a40885ed30ad898089a2cd
  Author: Andrew Browne <browneee at google.com>
  Date:   2021-06-25 (Fri, 25 Jun 2021)

  Changed paths:
    M clang/docs/DataFlowSanitizerDesign.rst
    M compiler-rt/lib/dfsan/dfsan.cpp
    M compiler-rt/lib/dfsan/dfsan.h
    M compiler-rt/lib/dfsan/dfsan_allocator.cpp
    M compiler-rt/lib/dfsan/dfsan_platform.h
    M compiler-rt/test/dfsan/origin_invalid.c
    M llvm/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp
    M llvm/test/Instrumentation/DataFlowSanitizer/atomics.ll
    M llvm/test/Instrumentation/DataFlowSanitizer/basic.ll
    M llvm/test/Instrumentation/DataFlowSanitizer/load.ll
    M llvm/test/Instrumentation/DataFlowSanitizer/origin_load.ll
    M llvm/test/Instrumentation/DataFlowSanitizer/origin_store.ll
    M llvm/test/Instrumentation/DataFlowSanitizer/store.ll

  Log Message:
  -----------
  [DFSan] Change shadow and origin memory layouts to match MSan.

Previously on x86_64:

  +--------------------+ 0x800000000000 (top of memory)
  | application memory |
  +--------------------+ 0x700000008000 (kAppAddr)
  |                    |
  |       unused       |
  |                    |
  +--------------------+ 0x300000000000 (kUnusedAddr)
  |       origin       |
  +--------------------+ 0x200000008000 (kOriginAddr)
  |       unused       |
  +--------------------+ 0x200000000000
  |   shadow memory    |
  +--------------------+ 0x100000008000 (kShadowAddr)
  |       unused       |
  +--------------------+ 0x000000010000
  | reserved by kernel |
  +--------------------+ 0x000000000000

  MEM_TO_SHADOW(mem) = mem & ~0x600000000000
  SHADOW_TO_ORIGIN(shadow) = kOriginAddr - kShadowAddr + shadow

Now for x86_64:

  +--------------------+ 0x800000000000 (top of memory)
  |    application 3   |
  +--------------------+ 0x700000000000
  |      invalid       |
  +--------------------+ 0x610000000000
  |      origin 1      |
  +--------------------+ 0x600000000000
  |    application 2   |
  +--------------------+ 0x510000000000
  |      shadow 1      |
  +--------------------+ 0x500000000000
  |      invalid       |
  +--------------------+ 0x400000000000
  |      origin 3      |
  +--------------------+ 0x300000000000
  |      shadow 3      |
  +--------------------+ 0x200000000000
  |      origin 2      |
  +--------------------+ 0x110000000000
  |      invalid       |
  +--------------------+ 0x100000000000
  |      shadow 2      |
  +--------------------+ 0x010000000000
  |    application 1   |
  +--------------------+ 0x000000000000

  MEM_TO_SHADOW(mem) = mem ^ 0x500000000000
  SHADOW_TO_ORIGIN(shadow) = shadow + 0x100000000000

Reviewed By: stephan.yichao.zhao, gbalats

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




More information about the All-commits mailing list