Giter VIP home page Giter VIP logo

triforcelinuxsyscallfuzzer's Introduction

TriforceLinuxSyscallFuzzer

New: For those looking to play with TriforceAFL and TLSF, Richard Johnson created a Dockerfile which installs both (and even builds a Linux kernel for you). It's available here https://hub.docker.com/r/moflow/afl-triforce/tags/.

This is a collection of files used to perform system call fuzzing of Linux x86_64 kernels using AFL and QEMU. To use it you will need TriforceAFL from https://github.com/nccgroup/TriforceAFL and a kernel image to fuzz. Scripts assume that TriforceAFL is found in $TAFL or ../TriforceAFL/ (N.B. building testAfl requires that ../TriforceAFL/config.h exist).

Building

To build:

  make

Fuzzing

To run, first install a kernel into ./kern/bzImage and extract /proc/kallsyms into ./kern/kallsyms. Set K=kern environment variable to point to your kernel. Now run:

  make inputs
  ./runFuzz -M M0

Note that the runFuzz script expects a master or slave name, as it always runs in master/slave mode. See the runFuzz script for more usage information.

Also Note that this only creates a small set of example inputs. To test a large number of important system calls, you will probably want to generate one example of each system call, or at least one example for every "shape" of system call. These should be placed in inputs/. See gen2.py for an example.

Reproducing

To reproduce test cases (such as crashes) run:

  ./runTest inputs/ex1
  ./runTest outputs/crashes/id*

You can also run the driver out of the emulated environment with the -t option, with verbose logging with -vv and without actually performing the system calls with -x:

  ./driver -tvvx < inputs/ex1
  strace ./driver -t < inputs/ex1

It is sometimes useful to be able to boot the kernel and interactively run tests. To do so, edit the rootTemplate files as you see fit (for example, to add more test tools to the root filesystem), then run:

  ./runCmd

Other commands other than the shell can be invoked by specifying them as command line arguments to runCmd. Note: when done with the shell, use ^A-c to get the QEMU prompt and type quit.

Debugging

Debugging is easiest with a kernel built with debugging symbols enabled. Use runTest to start the kernel and run a test through the driver, or use runCmd to manually run a test case from the shell. Edit your run script to include the -s option when starting afl-qemu-system-trace. This will enable gdb support on TCP port 1234. Use getvmlinux to extract the vmlinux kernel image from your bzImage kernel and run gdb after the system has booted:

   cp kern/bzImage .
   ./getvmlinux
   gdb ./vmlinux
   target remote :1234
   break somefunction
   continue

You can attach the debugger after runTest has caused a crash or before you manually trigger then bug in runCmd.

Note that Linux sources are compiled with optimization turned on by default. This can make debugging confusing and difficult. You can disable optimization on a file-by-file basis by editing the Linux make file for the subdirectory a file is in and adding CFLAGS_name.o = -O0 to the Makefile. For example editing kernel/Makefile and adding CFLAGS_sys_ni.o = -O0 will disable optimization when building kernel/sys_ni.o.

Utility

The getSyms shell script uses runCmd to execute cat /proc/kallsyms and extract it to a local file named kallsyms. This is typically used to prep your kernel for fuzzing:

  • run K=yourKernDir ./getSyms to get kallsyms
  • run mv kallsyms yourKernDir to install it

Bugs

Note: When fuzzing a Linux 2.* kernel you will need to enable the CPU timer. When the timer is not enabled panic and logging detection do not seem to operate properly and panics result in hangs. To enable the timer, call startForkserver(1) in driver.c instead of startForkserver(0). This issue does not seem to occur in Linux3.* and Linux4.* kernels.

triforcelinuxsyscallfuzzer's People

Contributors

jessemtso avatar timnewsham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

triforcelinuxsyscallfuzzer's Issues

when run runTest,how to debug qemu

hi,i am trying to make some change to the project.But i do not know how to debug the qemu.when i use runTest script to start the Test .i can not get the qemu output ,i only get the afltest output.can you tell me how to find the problem in qemu?
here is what i get:
use command runTest inputs:
[ 1.747389] scsi 1:0:0:0: CD-ROM QEMU QEMU DVD-ROM 2.5+ 5
[ 1.777170] Key type big_key registered
[ 1.786744] sr 1:0:0:0: [sr0] scsi3-mmc drive: 4x/4x cd/rw xa/form2 tray
[ 1.787125] cdrom: Uniform CD-ROM driver Revision: 3.20
[ 1.797968] sr 1:0:0:0: Attached scsi generic sg0 type 5
[ 1.802640] Key type encrypted registered
[ 1.802839] AppArmor: AppArmor sha1 policy hashing enabled
[ 1.803437] ima: No TPM chip found, activating TPM-bypass!
[ 1.803690] ima: Allocated hash algorithm: sha1
[ 1.806613] No architecture policies found
[ 1.807150] evm: Initialising EVM extended attributes:
[ 1.807283] evm: security.selinux
[ 1.807377] evm: security.SMACK64
[ 1.807458] evm: security.SMACK64EXEC
[ 1.807543] evm: security.SMACK64TRANSMUTE
[ 1.807641] evm: security.SMACK64MMAP
[ 1.807726] evm: security.apparmor
[ 1.807809] evm: security.ima
[ 1.807878] evm: security.capability
[ 1.807972] evm: HMAC attrs: 0x1
[ 1.814425] PM: Magic number: 13:597:28
[ 1.816200] rtc_cmos 00:00: setting system clock to 2021-03-17T13:02:42 UTC)
[ 1.839485] Freeing unused decrypted memory: 2040K
[ 1.847477] Freeing unused kernel image memory: 2660K
[ 1.847844] Write protecting the kernel read-only data: 22528k
[ 1.851320] Freeing unused kernel image memory: 2012K
[ 1.853148] Freeing unused kernel image memory: 1660K
[ 1.935417] x86/mm: Checked W+X mappings: passed, no W+X pages found.
[ 1.936142] Run /init as init process
this is another.this is a mark.pid 109090: startForkServer
ttttpid 109090: startForkServer
start up afl forkserver!
Input from inputs/ at time 1615986163.234739
test running in pid 109094
**
ERROR:/home/f/Desktop/triqemu4.2/TriforceAFL/qemu_mode/qemu/tcg/tcg.c:781:tcg_)
test ended with status 6
0 edges

fork server ended with status 200
boot time: 2.70
test time: 0.01
total time: 2.71
tests: 1
execs/sec: 115.21

use command ./runFuzz -M 10
f@ubuntu:~/Desktop/triqemu4.2/TriforceLinuxSyscallFuzzer$ ./runFuzz -M 10
make: 'inputs' is up to date.
make: 'fuzzRoot.cpio.gz' is up to date.
afl-fuzz 2.06b by [email protected]
[+] You have 2 CPU cores and 1 runnable tasks (utilization: 50%).
[+] Try parallel jobs - see docs/parallel_fuzzing.txt.
[] Checking core_pattern...
[
] Setting up output directories...
[+] Output directory exists but deemed OK to reuse.
[] Deleting old session data...
[+] Output dir cleanup successful.
[
] Scanning 'inputs'...
[+] No auto-generated dictionary tokens to reuse.
[] Creating hard links for all input files...
[
] Validating target binary...
[] Attempting dry run with 'id:000000,orig:ex1'...
[
] Spinning up the fork server...
[+] All right - fork server is up.
[!] WARNING: Test case results in a crash (skipping)
[] Attempting dry run with 'id:000001,orig:ex2'...
[!] WARNING: Test case results in a crash (skipping)
[
] Attempting dry run with 'id:000002,orig:ex3'...
[!] WARNING: Test case results in a crash (skipping)
[] Attempting dry run with 'id:000003,orig:ex4'...
[!] WARNING: Test case results in a crash (skipping)
[
] Attempting dry run with 'id:000004,orig:ex5'...
[!] WARNING: Test case results in a crash (skipping)
[] Attempting dry run with 'id:000005,orig:ex6'...
[!] WARNING: Test case results in a crash (skipping)
[
] Attempting dry run with 'id:000006,orig:ex7'...
[!] WARNING: Test case results in a crash (skipping)

[-] PROGRAM ABORT : All test cases time out or crash, giving up!
Location : perform_dry_run(), afl-fuzz.c:2725

f@ubuntu:~/Desktop/triqemu4.2/TriforceLinuxSyscallFuzzer$

Found one, now what?

Hey, sorry to be thick, but this is the first time I'm doing this ... So after 3 days of fuzzing 4.6.5, I got this single crash:

start up afl forkserver!
Input from outputs/M0/crashes/id:000000,sig:00,src:002140,op:ext_AO,pos:4 at time 1471587966.490247
test running in pid 29239
call 28
arg 0: argNum 40001d
arg 1: argNum 6400000707000000
arg 2: argNum 1d00640000000064
arg 3: argVec64 cafbf0 - size 0
arg 4: argNum 1d00000064
arg 5: argBuflen 0
read 44 bytes, parse result 0 nrecs 1
syscall 28 (40001d, 6400000707000000, 1d00640000000064, cafbf0, 1d00000064, 0)
[   18.875920] Injecting memory failure for page 0x35f2 at 0x40001d
[   18.875920] MCE 0x35f2: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x35f3 at 0x40101d
[   18.875920] MCE 0x35f3: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x35f4 at 0x40201d
[   18.875920] MCE 0x35f4: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x35f5 at 0x40301d
[   18.875920] MCE 0x35f5: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x35f6 at 0x40401d
[   18.875920] MCE 0x35f6: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x35f7 at 0x40501d
[   18.875920] MCE 0x35f7: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x35f8 at 0x40601d
[   18.875920] MCE 0x35f8: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x35f9 at 0x40701d
[   18.875920] MCE 0x35f9: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x35fa at 0x40801d
[   18.875920] MCE 0x35fa: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x35fb at 0x40901d
[   18.875920] MCE 0x35fb: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x35fc at 0x40a01d
[   18.875920] MCE 0x35fc: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x35fd at 0x40b01d
[   18.875920] MCE 0x35fd: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x35fe at 0x40c01d
[   18.875920] MCE 0x35fe: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x35ff at 0x40d01d
[   18.875920] MCE 0x35ff: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x2f6 at 0x40e01d
[   18.875920] MCE 0x2f6: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x2f7 at 0x40f01d
[   18.875920] MCE 0x2f7: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x2f8 at 0x41001d
[   18.875920] MCE 0x2f8: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x2f9 at 0x41101d
[   18.875920] MCE 0x2f9: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x2fa at 0x41201d
[   18.875920] MCE 0x2fa: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x2fb at 0x41301d
[   18.875920] MCE 0x2fb: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x2fc at 0x41401d
[   18.875920] MCE 0x2fc: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x2fd at 0x41501d
[   18.875920] MCE 0x2fd: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x2fe at 0x41601d
[   18.875920] MCE 0x2fe: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x2ff at 0x41701d
[   18.875920] MCE 0x2ff: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x300 at 0x41801d
[   18.875920] MCE 0x300: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x301 at 0x41901d
[   18.875920] MCE 0x301: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x302 at 0x41a01d
[   18.875920] MCE 0x302: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x303 at 0x41b01d
[   18.875920] MCE 0x303: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x304 at 0x41c01d
[   18.875920] MCE 0x304: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x305 at 0x41d01d
[   18.875920] MCE 0x305: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x306 at 0x41e01d
[   18.875920] MCE 0x306: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x307 at 0x41f01d
[   18.875920] MCE 0x307: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x308 at 0x42001d
[   18.875920] MCE 0x308: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x309 at 0x42101d
[   18.875920] MCE 0x309: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x30a at 0x42201d
[   18.875920] MCE 0x30a: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39c0 at 0x42301d
[   18.875920] MCE 0x39c0: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39c1 at 0x42401d
[   18.875920] MCE 0x39c1: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39c2 at 0x42501d
[   18.875920] MCE 0x39c2: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39c3 at 0x42601d
[   18.875920] MCE 0x39c3: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39c4 at 0x42701d
[   18.875920] MCE 0x39c4: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39c5 at 0x42801d
[   18.875920] MCE 0x39c5: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39c6 at 0x42901d
[   18.875920] MCE 0x39c6: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39c7 at 0x42a01d
[   18.875920] MCE 0x39c7: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39c8 at 0x42b01d
[   18.875920] MCE 0x39c8: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39c9 at 0x42c01d
[   18.875920] MCE 0x39c9: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39ca at 0x42d01d
[   18.875920] MCE 0x39ca: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39cb at 0x42e01d
[   18.875920] MCE 0x39cb: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39cc at 0x42f01d
[   18.875920] MCE 0x39cc: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39cd at 0x43001d
[   18.875920] MCE 0x39cd: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39ce at 0x43101d
[   18.875920] MCE 0x39ce: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39cf at 0x43201d
[   18.875920] MCE 0x39cf: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39d0 at 0x43301d
[   18.875920] MCE 0x39d0: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39d1 at 0x43401d
[   18.875920] MCE 0x39d1: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39d2 at 0x43501d
[   18.875920] MCE 0x39d2: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39d3 at 0x43601d
[   18.875920] MCE 0x39d3: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39d4 at 0x43701d
[   18.875920] MCE 0x39d4: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39d5 at 0x43801d
[   18.875920] MCE 0x39d5: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39d6 at 0x43901d
[   18.875920] MCE 0x39d6: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39d7 at 0x43a01d
[   18.875920] MCE 0x39d7: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39d8 at 0x43b01d
[   18.875920] MCE 0x39d8: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39d9 at 0x43c01d
[   18.875920] MCE 0x39d9: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39da at 0x43d01d
[   18.875920] MCE 0x39da: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39db at 0x43e01d
[   18.875920] MCE 0x39db: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39dc at 0x43f01d
[   18.875920] MCE 0x39dc: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39dd at 0x44001d
[   18.875920] MCE 0x39dd: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39de at 0x44101d
[   18.875920] MCE 0x39de: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x30b at 0x44201d
[   18.875920] MCE 0x30b: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x30c at 0x44301d
[   18.875920] MCE 0x30c: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x30d at 0x44401d
[   18.875920] MCE 0x30d: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x30e at 0x44501d
[   18.875920] MCE 0x30e: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x30f at 0x44601d
[   18.875920] MCE 0x30f: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x310 at 0x44701d
[   18.875920] MCE 0x310: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x311 at 0x44801d
[   18.875920] MCE 0x311: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x312 at 0x44901d
[   18.875920] MCE 0x312: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x313 at 0x44a01d
[   18.875920] MCE 0x313: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x314 at 0x44b01d
[   18.875920] MCE 0x314: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x315 at 0x44c01d
[   18.875920] MCE 0x315: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x316 at 0x44d01d
[   18.875920] MCE 0x316: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x317 at 0x44e01d
[   18.875920] MCE 0x317: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x318 at 0x44f01d
[   18.875920] MCE 0x318: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x319 at 0x45001d
[   18.875920] MCE 0x319: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x31a at 0x45101d
[   18.875920] MCE 0x31a: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x31b at 0x45201d
[   18.875920] MCE 0x31b: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x31c at 0x45301d
[   18.875920] MCE 0x31c: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x31d at 0x45401d
[   18.875920] MCE 0x31d: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x31e at 0x45501d
[   18.875920] MCE 0x31e: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x31f at 0x45601d
[   18.875920] MCE 0x31f: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39df at 0x45701d
[   18.875920] MCE 0x39df: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39e0 at 0x45801d
[   18.875920] MCE 0x39e0: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39e1 at 0x45901d
[   18.875920] MCE 0x39e1: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39e2 at 0x45a01d
[   18.875920] MCE 0x39e2: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39e3 at 0x45b01d
[   18.875920] MCE 0x39e3: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39e4 at 0x45c01d
[   18.875920] MCE 0x39e4: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39e5 at 0x45d01d
[   18.875920] MCE 0x39e5: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39e6 at 0x45e01d
[   18.875920] MCE 0x39e6: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39e7 at 0x45f01d
[   18.875920] MCE 0x39e7: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39e8 at 0x46001d
[   18.875920] MCE 0x39e8: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39e9 at 0x46101d
[   18.875920] MCE 0x39e9: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39ea at 0x46201d
[   18.875920] MCE 0x39ea: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39eb at 0x46301d
[   18.875920] MCE 0x39eb: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39ec at 0x46401d
[   18.875920] MCE 0x39ec: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39ed at 0x46501d
[   18.875920] MCE 0x39ed: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39ee at 0x46601d
[   18.875920] MCE 0x39ee: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39ef at 0x46701d
[   18.875920] MCE 0x39ef: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39f0 at 0x46801d
[   18.875920] MCE 0x39f0: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39f1 at 0x46901d
[   18.875920] MCE 0x39f1: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39f2 at 0x46a01d
[   18.875920] MCE 0x39f2: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39f3 at 0x46b01d
[   18.875920] MCE 0x39f3: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39f4 at 0x46c01d
[   18.875920] MCE 0x39f4: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39f5 at 0x46d01d
[   18.875920] MCE 0x39f5: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39f6 at 0x46e01d
[   18.875920] MCE 0x39f6: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39f7 at 0x46f01d
[   18.875920] MCE 0x39f7: recovery action for dirty LRU page: Recovered
[   18.875920] Injecting memory failure for page 0x39f8 at 0x47001d
[   18.875920] MCE 0x39f8: dirty LRU page still referenced by 1 users
[   18.875920] MCE 0x39f8: recovery action for dirty LRU page: Failed
[   18.875920] MCE: Killing driver:123 due to hardware memory corruption fault at 444ca9
[   18.875920] MCE: Killing driver:1 due to hardware memory corruption fault at 441c8a
[   18.875920] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000007
[   18.875920] 
[   18.875920] CPU: 0 PID: 1 Comm: driver Not tainted 4.6.5-rt9 #1
[   18.875920] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.8.1-0-g4adadbd-20150316_085822-nilsson.home.kraxel.org 04/01/2014
[   18.875920]  0000000000000086 000000008ac765a6 ffff880002d93c30 ffffffff81400776
[   18.875920]  ffffffff81c84be0 ffff880002d93cc8 ffff880002d93cb8 ffffffff811a12ae
[   18.875920]  ffffffff00000010 ffff880002d93cc8 ffff880002d93c60 000000008ac765a6
[   18.875920] Call Trace:
[   18.875920]  [<ffffffff81400776>] dump_stack+0x63/0x8d
[   18.875920]  [<ffffffff811a12ae>] panic+0xde/0x220
[   18.875920]  [<ffffffff810882b7>] do_exit+0xb77/0xb80
[   18.875920]  [<ffffffff81088350>] do_group_exit+0x50/0xd0
[   18.875920]  [<ffffffff81094dc2>] get_signal+0x282/0x680
[   18.875920]  [<ffffffff810aaeea>] ? migrate_enable+0x7a/0x130
[   18.875920]  [<ffffffff8102f5b7>] do_signal+0x37/0x770
[   18.875920]  [<ffffffff810e3699>] ? vprintk_default+0x29/0x40
[   18.875920]  [<ffffffff811a15e6>] ? printk+0x57/0x73
[   18.875920]  [<ffffffff810e3699>] ? vprintk_default+0x29/0x40
[   18.875920]  [<ffffffff8106cbd1>] ? mm_fault_error+0x141/0x190
[   18.875920]  [<ffffffff8106d110>] ? __do_page_fault+0x4f0/0x540
[   18.875920]  [<ffffffff810032b4>] exit_to_usermode_loop+0xf4/0x150
[   18.875920]  [<ffffffff81003d98>] prepare_exit_to_usermode+0x38/0x40
[   18.875920]  [<ffffffff818537ef>] retint_user+0x8/0x10
[   18.875920] Kernel Offset: disabled

timeout
test ended with status 9
5964 edges

fork server ended with status 200
boot time:  29.70
test time:  2.02
total time: 31.72
tests:     1
execs/sec: 0.49

I can provide you with the crash input file also. Now, questions:

  1. It's madvise right ? How do I know whether this is kernel side or qemu side of things ?
  2. Is there any way to re-run this on bare hardware/VM outside of qemu?
  3. Does it look legit ?

How to fuzz a application written by myself?

I replace the heater.c with the program I wrote, but it seems like it does not work. I read your blog but didn't find any tutorial on that? Could you give me some hint? Any help will be appreciated.

Hitting Fork Server handshake Failed

I put my bzImage & kallsyms under kern/ & triggered runFuzz -M M0:
Getting aborted just on attempting dry run:

[*] Spinning up the fork server...

[-] Hmm, looks like the target binary terminated before we could complete a
handshake with the injected code. There are two probable explanations:

- The current memory limit (2.00 GB) is too restrictive, causing an OOM
  fault in the dynamic linker. This can be fixed with the -m option. A
  simple way to confirm the diagnosis may be:

  ( ulimit -Sv $[2047 << 10]; /path/to/fuzzed_app )

  Tip: you can use http://jwilk.net/software/recidivm to quickly
  estimate the required amount of virtual memory for the binary.

- Less likely, there is a horrible bug in the fuzzer. If other options
  fail, poke <[email protected]> for troubleshooting tips.

[-] PROGRAM ABORT : Fork server handshake failed
Location : init_forkserver(), afl-fuzz.c:2123

I also tried setting AFL_NO_FORKSRV=1, but didn;t help much:
[] Attempting dry run with 'id:000000,orig:ex1'...
[!] WARNING: Test case results in a crash (skipping)
[
] Attempting dry run with 'id:000001,orig:ex2'...
[!] WARNING: Test case results in a crash (skipping)
[] Attempting dry run with 'id:000002,orig:ex3'...
[!] WARNING: Test case results in a crash (skipping)
[
] Attempting dry run with 'id:000003,orig:ex4'...
[!] WARNING: Test case results in a crash (skipping)
[] Attempting dry run with 'id:000004,orig:ex5'...
[!] WARNING: Test case results in a crash (skipping)
[
] Attempting dry run with 'id:000005,orig:ex6'...
[!] WARNING: Test case results in a crash (skipping)
[*] Attempting dry run with 'id:000006,orig:ex7'...
[!] WARNING: Test case results in a crash (skipping)

[-] PROGRAM ABORT : All test cases time out or crash, giving up!
Location : perform_dry_run(), afl-fuzz.c:2725

Missing licence in repository

Hi,

I discover there is neither COPYING nor LICENCE / LICENSE file inside this repository. Could you please clarify which licence is applied to this repository?

Thanks,
Wei.

capturing driver sigsegv's ?

Hey, I've been running this on 4.6.5-rt for quite a while now. Didn't find any kernel crashes luckily, but got some interesting driver app crashes:

id 5909 time 1471281654.181486
driver[124]: segfault at 444ca9 ip 0000000000444ca9 sp 00007ffe63d40708 error 14

pid 5973 time 1471281654.597445
driver[124]: segfault at 6d1bd4 ip 00000000004010a4 sp 00007ffe63d40770 error 4 in driver[400000+d0000]
driver[124]: segfault at 6d1bd4 ip 00000000004010a4 sp 00007ffe63d40770 error 4 in driver[400000+d0000]

Now I didn't isolate inputs that do it, but I'd be curious to dig deeper into the in order to make driver more robust. How would I do that ? Does it make any sense ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.