[PATCH] D61066: [fuzzer] Fix reload.test on Linux/aarch64

Adhemerval Zanella via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 24 07:08:06 PDT 2019


zatrazz created this revision.
zatrazz added reviewers: kcc, vitalybuka.
zatrazz added projects: LLVM, Sanitizers.
Herald added subscribers: dexonsmith, kristof.beyls, javed.absar.

The compiler generates a 'brk' instruction for __builtin_trap on
aarch64 and Linux kernel issues a SIGTRAP, different from x86
where compiler emits an ud2 for __builtin_trap and Linux issue
a SIGILL.

A straightforward is to use abort instead.


Repository:
  rL LLVM

https://reviews.llvm.org/D61066

Files:
  compiler-rt/test/fuzzer/ReloadTest.cpp


Index: compiler-rt/test/fuzzer/ReloadTest.cpp
===================================================================
--- compiler-rt/test/fuzzer/ReloadTest.cpp
+++ compiler-rt/test/fuzzer/ReloadTest.cpp
@@ -5,9 +5,9 @@
 // Test that fuzzer we can reload artifacts with any bytes inside.
 #include <algorithm>
 #include <cstdint>
+#include <cstdlib>
 #include <numeric>
 #include <set>
-#include <stdio.h>
 
 extern "C" size_t LLVMFuzzerCustomMutator(uint8_t *Data, size_t Size,
                                           size_t MaxSize, unsigned int Seed) {
@@ -19,6 +19,6 @@
 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   if (Size > 5000 && std::set<uint8_t>(Data, Data + Size).size() > 255 &&
       (uint8_t)std::accumulate(Data, Data + Size, uint8_t(Size)) == 0)
-    __builtin_trap();
+    abort();
   return 0;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61066.196443.patch
Type: text/x-patch
Size: 848 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190424/695924c2/attachment.bin>


More information about the llvm-commits mailing list