[PATCH] PR20721: Don't let UBSan print inaccessible memory

Alexey Samsonov vonosmas at gmail.com
Mon Sep 8 16:56:11 PDT 2014


Hi eugenis,

UBSan needs to check if memory snippet it's going to print resides
in addressable memory. Similar check might be helpful in ASan with
dump_instruction_bytes option (see http://reviews.llvm.org/D5167).

Instead of scanning /proc/self/maps manually, delegate this check to
the OS kernel: try to write this memory in a syscall and assume that
memory is inaccessible if the syscall failed (e.g. with EFAULT).

http://reviews.llvm.org/D5253

Files:
  lib/sanitizer_common/sanitizer_common.h
  lib/sanitizer_common/sanitizer_posix_libcdep.cc
  lib/sanitizer_common/sanitizer_win.cc
  lib/ubsan/ubsan_diag.cc
  test/ubsan/TestCases/TypeCheck/misaligned.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D5253.13431.patch
Type: text/x-patch
Size: 5037 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140908/8b0e5128/attachment.bin>


More information about the llvm-commits mailing list