llvm-project/llvm/lib
Yonghong Song 150ca5143b bpf: check illegal usage of XADD insn return value
Currently, BPF has XADD (locked add) insn support and the
asm looks like:
  lock *(u32 *)(r1 + 0) += r2
  lock *(u64 *)(r1 + 0) += r2
The instruction itself does not have a return value.

At the source code level, users often use
  __sync_fetch_and_add()
which eventually translates to XADD. The return value of
__sync_fetch_and_add() is supposed to be the old value
in the xadd memory location. Since BPF::XADD insn does not
support such a return value, this patch added a PreEmit
phase to check such a usage. If such an illegal usage
pattern is detected, a fatal error will be reported like
  line 4: Invalid usage of the XADD return value
if compiled with -g, or
  Invalid usage of the XADD return value
if compiled without -g.

Signed-off-by: Yonghong Song <yhs@fb.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
llvm-svn: 342692
2018-09-20 22:24:27 +00:00
..
Analysis [inline Cost] Don't mark functions accessing varargs as non-inlinable 2018-09-20 18:39:34 +00:00
AsmParser [IR] Add a boolean field in DILocation to know if a line must covered or not 2018-09-20 08:53:06 +00:00
BinaryFormat [WebAssembly] clang-format (NFC) 2018-09-05 01:27:38 +00:00
Bitcode [Bitcode] Address backwards compat bug in r342631 2018-09-20 18:59:33 +00:00
CodeGen [MachineOutliner][NFC] Don't add MBBs with a size < 2 to the search space 2018-09-20 21:53:25 +00:00
DebugInfo [PDB] Fix -Wcovered-switch-default warning. 2018-09-20 19:57:49 +00:00
Demangle Update microsoftDemangle() to work more like itaniumDemangle(). 2018-09-15 18:24:20 +00:00
ExecutionEngine [ORC] Merge ExecutionSessionBase with ExecutionSession by moving a couple of 2018-09-12 21:49:02 +00:00
FuzzMutate [New PM] Introducing PassInstrumentation framework 2018-09-20 17:08:45 +00:00
Fuzzer
IR [New PM] Introducing PassInstrumentation framework 2018-09-20 17:08:45 +00:00
IRReader
LTO [ThinLTOCodeGenerator] Avoid Rehash StringMap in ThreadPool 2018-09-14 19:38:21 +00:00
LineEditor
Linker [NFC] Remove an empty line. 2018-07-27 06:50:45 +00:00
MC Fix for bug 34002 - label generated before it block is finalized. Differential Revision: https://reviews.llvm.org/D52258 2018-09-20 05:11:42 +00:00
Object [object] Improve the performance of getSymbols used by ArchiveWriter 2018-09-11 22:00:47 +00:00
ObjectYAML [WebAssembly] Add V128 value type to binary format 2018-09-20 22:04:44 +00:00
Option Revert r341329 due to MSAN error 2018-09-03 18:13:46 +00:00
Passes [New PM] Introducing PassInstrumentation framework 2018-09-20 17:08:45 +00:00
ProfileData [gcov] Fix wrong line hit counts when multiple blocks are on the same line 2018-09-20 16:09:30 +00:00
Support Remove dead function user_cache_directory() 2018-09-18 15:06:16 +00:00
TableGen Remove trailing space 2018-07-30 19:41:25 +00:00
Target bpf: check illegal usage of XADD insn return value 2018-09-20 22:24:27 +00:00
Testing Fix error with SmallString implicit conversion. 2018-09-06 22:47:32 +00:00
ToolDrivers Give llvm-lib rudimentary help output. 2018-07-14 02:29:44 +00:00
Transforms [GlobalDCE] AvailableExternal linkage is checked in isDiscardableIfUnused [NFC]. 2018-09-20 21:16:16 +00:00
WindowsManifest Convert line endings of lib/WindowsManifest/CMakeLists.txt to unix. 2018-04-07 04:28:08 +00:00
XRay [XRay] Bug fixes for FDR custom event and arg-logging 2018-09-13 09:25:42 +00:00
CMakeLists.txt
LLVMBuild.txt