All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH fuzzer v1] Added the --ignore-sigill option for AFL fuzzing
@ 2019-04-18 15:02 ` Sam Caccavale
  0 siblings, 0 replies; 12+ messages in thread
From: Sam Caccavale @ 2019-04-18 15:02 UTC (permalink / raw)
  To: xen-devel
  Cc: Sam Caccavale, Andrew Cooper, Martin Pohlack,
	Pawel Wieczorkiewicz, David Woodhouse, Jan Beulich,
	Martin Mazein, Bjoern Doebel, Norbert Manthey

As of now, the x86_instruction_emulator will execute opcodes
belonging to CPU extensions that the host may not have.
Specifying --ignore-sigill when running afl-harness will ignore
all SIG_ILL including those generated by the above issue.
---
 .../fuzz/x86_instruction_emulator/afl-harness.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/tools/fuzz/x86_instruction_emulator/afl-harness.c b/tools/fuzz/x86_instruction_emulator/afl-harness.c
--- a/tools/fuzz/x86_instruction_emulator/afl-harness.c
+++ b/tools/fuzz/x86_instruction_emulator/afl-harness.c
@@ -1,4 +1,5 @@
 #include <assert.h>
+#include <signal.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -8,11 +9,17 @@
 
 static uint8_t input[INPUT_SIZE];
 
+void SIGILL_handler(int signo) {
+    printf("Exiting due to executing an unsupported opcdode.\n");
+    exit(0);
+}
+
 int main(int argc, char **argv)
 {
     size_t size;
     FILE *fp = NULL;
     int max, count;
+    struct sigaction sa, osa;
 
     setbuf(stdin, NULL);
     setbuf(stdout, NULL);
@@ -20,9 +27,11 @@ int main(int argc, char **argv)
     while ( 1 )
     {
         enum {
+            IGNORE_SIGILL,
             OPT_MIN_SIZE,
         };
         static const struct option lopts[] = {
+            { "ignore-sigill", no_argument, NULL, IGNORE_SIGILL },
             { "min-input-size", no_argument, NULL, OPT_MIN_SIZE },
             { 0, 0, 0, 0 }
         };
@@ -33,13 +42,19 @@ int main(int argc, char **argv)
 
         switch ( c )
         {
+        case IGNORE_SIGILL:
+            sa.sa_flags = 0;
+            sa.sa_handler = SIGILL_handler;
+            sigaction(SIGILL, &sa, &osa);
+            break;
+
         case OPT_MIN_SIZE:
             printf("%u\n", fuzz_minimal_input_size());
             exit(0);
             break;
 
         case '?':
-            printf("Usage: %s $FILE [$FILE...] | [--min-input-size]\n", argv[0]);
+            printf("Usage: %s $FILE [$FILE...] [--ignore-sigill] | [--min-input-size]\n", argv[0]);
             exit(-1);
             break;
 
-- 
2.17.1




Amazon Development Center Germany GmbH
Krausenstr. 38
10117 Berlin
Geschaeftsfuehrer: Christian Schlaeger, Ralf Herbrich
Ust-ID: DE 289 237 879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2019-04-23 10:26 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-18 15:02 [PATCH fuzzer v1] Added the --ignore-sigill option for AFL fuzzing Sam Caccavale
2019-04-18 15:02 ` [Xen-devel] " Sam Caccavale
2019-04-18 16:18 ` Andrew Cooper
2019-04-18 16:18   ` [Xen-devel] " Andrew Cooper
2019-04-23  9:10   ` Caccavale, Samuel
2019-04-23  9:10     ` [Xen-devel] " Caccavale, Samuel
2019-04-23 10:02     ` Andrew Cooper
2019-04-23 10:02       ` [Xen-devel] " Andrew Cooper
2019-04-23 10:12       ` Caccavale, Samuel
2019-04-23 10:12         ` [Xen-devel] " Caccavale, Samuel
2019-04-23 10:25         ` Andrew Cooper
2019-04-23 10:25           ` [Xen-devel] " Andrew Cooper

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.