mirror of
https://github.com/reactos/syzkaller.git
synced 2024-11-23 03:19:51 +00:00
tools/check-whitespace.sh: check for trailing whitespaces
File types that we don't format automatically can end up with such basic untidiness as trailing whitespaces. Check for these. Remove all existing precedents.
This commit is contained in:
parent
3f1d02b23f
commit
fab7609913
7
Makefile
7
Makefile
@ -102,7 +102,7 @@ endif
|
||||
bin/syz-extract bin/syz-fmt \
|
||||
extract generate generate_go generate_sys \
|
||||
format format_go format_cpp format_sys \
|
||||
tidy test test_race check_copyright check_language check_links check_diff check_commits \
|
||||
tidy test test_race check_copyright check_language check_whitespace check_links check_diff check_commits \
|
||||
presubmit presubmit_smoke presubmit_build presubmit_arch presubmit_big presubmit_race presubmit_old
|
||||
|
||||
all: host target
|
||||
@ -266,7 +266,7 @@ presubmit:
|
||||
|
||||
presubmit_smoke:
|
||||
$(MAKE) generate
|
||||
$(MAKE) -j100 check_commits check_diff check_copyright check_language check_links presubmit_build tidy
|
||||
$(MAKE) -j100 check_commits check_diff check_copyright check_language check_whitespace check_links presubmit_build tidy
|
||||
$(MAKE) test
|
||||
|
||||
presubmit_build:
|
||||
@ -353,6 +353,9 @@ check_copyright:
|
||||
check_language:
|
||||
./tools/check-language.sh
|
||||
|
||||
check_whitespace:
|
||||
./tools/check-whitespace.sh
|
||||
|
||||
check_commits:
|
||||
./tools/check-commits.sh
|
||||
|
||||
|
@ -66,7 +66,7 @@ function util_add_usb_bits {
|
||||
scripts/config -d CONFIG_USB_GADGETFS
|
||||
scripts/config -d CONFIG_USB_LIBCOMPOSITE
|
||||
scripts/config -d CONFIG_USB_CONFIGFS
|
||||
|
||||
|
||||
scripts/config -e CONFIG_USB_GADGET
|
||||
scripts/config -e CONFIG_USB_DUMMY_HCD
|
||||
scripts/config -e CONFIG_USB_RAW_GADGET
|
||||
|
@ -151,48 +151,48 @@ These instructions describe how to set this up on a Raspberry Pi Zero W, but any
|
||||
|
||||
9. Download syzkaller, apply the patch below and build `syz-executor`:
|
||||
|
||||
``` c
|
||||
diff --git a/executor/common_usb.h b/executor/common_usb.h
|
||||
index e342d808..278c2f4e 100644
|
||||
--- a/executor/common_usb.h
|
||||
+++ b/executor/common_usb.h
|
||||
@@ -269,9 +269,7 @@ static volatile long syz_usb_connect(volatile long a0, volatile long a1, volatil
|
||||
|
||||
// TODO: consider creating two dummy_udc's per proc to increace the chance of
|
||||
// triggering interaction between multiple USB devices within the same program.
|
||||
- char device[32];
|
||||
- sprintf(&device[0], "dummy_udc.%llu", procid);
|
||||
- rv = usb_raw_init(fd, speed, "dummy_udc", &device[0]);
|
||||
+ rv = usb_raw_init(fd, speed, "20980000.usb", "20980000.usb");
|
||||
if (rv < 0) {
|
||||
debug("syz_usb_connect: usb_raw_init failed with %d\n", rv);
|
||||
return rv;
|
||||
diff --git a/executor/executor.cc b/executor/executor.cc
|
||||
index 34949a01..1afcb288 100644
|
||||
--- a/executor/executor.cc
|
||||
+++ b/executor/executor.cc
|
||||
@@ -604,8 +604,8 @@ retry:
|
||||
call_extra_cover = true;
|
||||
}
|
||||
if (strncmp(syscalls[call_num].name, "syz_usb_connect", strlen("syz_usb_connect")) == 0) {
|
||||
- prog_extra_timeout = 2000;
|
||||
- call_extra_timeout = 2000;
|
||||
+ prog_extra_timeout = 5000;
|
||||
+ call_extra_timeout = 5000;
|
||||
}
|
||||
if (strncmp(syscalls[call_num].name, "syz_usb_control_io", strlen("syz_usb_control_io")) == 0)
|
||||
call_extra_timeout = 300;
|
||||
```
|
||||
``` c
|
||||
diff --git a/executor/common_usb.h b/executor/common_usb.h
|
||||
index e342d808..278c2f4e 100644
|
||||
--- a/executor/common_usb.h
|
||||
+++ b/executor/common_usb.h
|
||||
@@ -269,9 +269,7 @@ static volatile long syz_usb_connect(volatile long a0, volatile long a1, volatil
|
||||
|
||||
``` bash
|
||||
go get -u -d github.com/google/syzkaller/prog
|
||||
cd ~/gopath/src/github.com/google/syzkaller
|
||||
# Put the patch above into ./syzkaller.patch
|
||||
git apply ./syzkaller.patch
|
||||
make executor
|
||||
mkdir ~/syz-bin
|
||||
cp bin/linux_arm/syz-executor ~/syz-bin/
|
||||
```
|
||||
// TODO: consider creating two dummy_udc's per proc to increace the chance of
|
||||
// triggering interaction between multiple USB devices within the same program.
|
||||
- char device[32];
|
||||
- sprintf(&device[0], "dummy_udc.%llu", procid);
|
||||
- rv = usb_raw_init(fd, speed, "dummy_udc", &device[0]);
|
||||
+ rv = usb_raw_init(fd, speed, "20980000.usb", "20980000.usb");
|
||||
if (rv < 0) {
|
||||
debug("syz_usb_connect: usb_raw_init failed with %d\n", rv);
|
||||
return rv;
|
||||
diff --git a/executor/executor.cc b/executor/executor.cc
|
||||
index 34949a01..1afcb288 100644
|
||||
--- a/executor/executor.cc
|
||||
+++ b/executor/executor.cc
|
||||
@@ -604,8 +604,8 @@ retry:
|
||||
call_extra_cover = true;
|
||||
}
|
||||
if (strncmp(syscalls[call_num].name, "syz_usb_connect", strlen("syz_usb_connect")) == 0) {
|
||||
- prog_extra_timeout = 2000;
|
||||
- call_extra_timeout = 2000;
|
||||
+ prog_extra_timeout = 5000;
|
||||
+ call_extra_timeout = 5000;
|
||||
}
|
||||
if (strncmp(syscalls[call_num].name, "syz_usb_control_io", strlen("syz_usb_control_io")) == 0)
|
||||
call_extra_timeout = 300;
|
||||
```
|
||||
|
||||
``` bash
|
||||
go get -u -d github.com/google/syzkaller/prog
|
||||
cd ~/gopath/src/github.com/google/syzkaller
|
||||
# Put the patch above into ./syzkaller.patch
|
||||
git apply ./syzkaller.patch
|
||||
make executor
|
||||
mkdir ~/syz-bin
|
||||
cp bin/linux_arm/syz-executor ~/syz-bin/
|
||||
```
|
||||
|
||||
10. Build `syz-execprog` on your host machine for arm32 with `make TARGETARCH=arm execprog` and copy to `~/syz-bin` onto the SD card. You may try building syz-execprog on the Raspberry Pi itself, but that worked poorly for me due to large memory consumption during the compilation process.
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
This document details the steps involved in setting up a syzkaller instance fuzzing an `arm32/64` linux kernel on an Android device.
|
||||
|
||||
Some features of syzkaller may not yet work properly on `arm32`. For example, not all debugging and test coverage features are available in the Linux kernel for `arm32`, limiting the efficacy of syskaller in finding bugs fast.
|
||||
|
||||
|
||||
These were tested on an NXP Pico-Pi-IMX7D following the instructions [here](https://developer.android.com/things/hardware/developer-kits.html).
|
||||
|
||||
You may find additional details in syzkaller's `adb` vm implementation [here](/vm/adb/adb.go).
|
||||
|
@ -5,7 +5,7 @@
|
||||
Obtain a fresh `arm-linux-gnueabihf-gcc`. Latest Debian distributions provide
|
||||
version 7.2.0, which should be enough. Otherwise you can download Linaro
|
||||
compiler [here](https://www.linaro.org/downloads).
|
||||
|
||||
|
||||
# Kernel
|
||||
|
||||
The instructions are tested with `v4.16.1`. Check that you have/backport
|
||||
@ -77,7 +77,7 @@ debugfs /sys/kernel/debug debugfs defaults 0 0
|
||||
```
|
||||
|
||||
Then replace `output/target/etc/ssh/sshd_config` with the following contents:
|
||||
|
||||
|
||||
```
|
||||
PermitRootLogin yes
|
||||
PasswordAuthentication yes
|
||||
|
@ -109,7 +109,7 @@ At the top of /etc/init.d/S50sshd add the following lines:
|
||||
mount -t debugfs none /sys/kernel/debug
|
||||
chmod 777 /sys/kernel/debug/kcov
|
||||
|
||||
Comment out the line
|
||||
Comment out the line
|
||||
|
||||
/usr/bin/ssh-keygen -A
|
||||
|
||||
|
@ -75,7 +75,7 @@ Now you should have `vmlinux` (kernel binary) and `bzImage` (packed kernel image
|
||||
``` bash
|
||||
$ ls $KERNEL/vmlinux
|
||||
$KERNEL/vmlinux
|
||||
$ ls $KERNEL/arch/s390/boot/bzImage
|
||||
$ ls $KERNEL/arch/s390/boot/bzImage
|
||||
$KERNEL/arch/s390/boot/bzImage
|
||||
```
|
||||
|
||||
|
@ -80,7 +80,7 @@ Some message
|
||||
|
||||
``` bash
|
||||
$ ssh root@172.16.0.31
|
||||
root@172.16.0.31's password:
|
||||
root@172.16.0.31's password:
|
||||
...
|
||||
Last login: Thu Feb 11 11:30:51 2016
|
||||
root@odroid64:~#
|
||||
@ -93,7 +93,7 @@ This hub has support for a feature called [Per Port Power Switching](http://www.
|
||||
|
||||
[To be able to open the hub device entry](http://www.janosgyerik.com/adding-udev-rules-for-usb-debugging-android-devices/) under `/dev/` without being root, add the following file to `/etc/udev/rules.d/` on the host machine:
|
||||
``` bash
|
||||
$ cat /etc/udev/rules.d/10-local.rules
|
||||
$ cat /etc/udev/rules.d/10-local.rules
|
||||
SUBSYSTEM=="usb", ATTR{idVendor}=="2001", ATTR{idProduct}=="f103", MODE="0664", GROUP="plugdev"
|
||||
```
|
||||
|
||||
@ -101,7 +101,7 @@ SUBSYSTEM=="usb", ATTR{idVendor}=="2001", ATTR{idProduct}=="f103", MODE="0664",
|
||||
Don't forget to replug the hub after you add this file.
|
||||
|
||||
``` bash
|
||||
$ lsusb
|
||||
$ lsusb
|
||||
...
|
||||
Bus 003 Device 026: ID 2001:f103 D-Link Corp. DUB-H7 7-port USB 2.0 hub
|
||||
...
|
||||
@ -159,14 +159,14 @@ index 165cf9783a5d..ff8b40dca9e2 100644
|
||||
@@ -653,6 +653,11 @@ KBUILD_CFLAGS += $(call cc-ifversion, -lt, 0409, \
|
||||
# Tell gcc to never replace conditional load with a non-conditional one
|
||||
KBUILD_CFLAGS += $(call cc-option,--param=allow-store-data-races=0)
|
||||
|
||||
|
||||
+# Stop gcc from converting switches into a form that defeats dead code
|
||||
+# elimination and can subsequently lead to calls to intentionally
|
||||
+# undefined functions appearing in the final link.
|
||||
+KBUILD_CFLAGS += $(call cc-option,--param=max-fsm-thread-path-insns=1)
|
||||
+
|
||||
include scripts/Makefile.gcc-plugins
|
||||
|
||||
|
||||
ifdef CONFIG_READABLE_ASM
|
||||
```
|
||||
|
||||
@ -177,12 +177,12 @@ index 9576775a86f6..8bc4eb36fc1b 100644
|
||||
--- a/scripts/Makefile.kasan
|
||||
+++ b/scripts/Makefile.kasan
|
||||
@@ -11,7 +11,6 @@ CFLAGS_KASAN_MINIMAL := -fsanitize=kernel-address
|
||||
|
||||
|
||||
CFLAGS_KASAN := $(call cc-option, -fsanitize=kernel-address \
|
||||
-fasan-shadow-offset=$(KASAN_SHADOW_OFFSET) \
|
||||
- --param asan-stack=1 --param asan-globals=1 \
|
||||
--param asan-instrumentation-with-call-threshold=$(call_threshold))
|
||||
|
||||
|
||||
ifeq ($(call cc-option, $(CFLAGS_KASAN_MINIMAL) -Werror),)
|
||||
```
|
||||
|
||||
|
@ -70,7 +70,7 @@ Now you should have `vmlinux` (kernel binary) and `bzImage` (packed kernel image
|
||||
``` bash
|
||||
$ ls $KERNEL/vmlinux
|
||||
$KERNEL/vmlinux
|
||||
$ ls $KERNEL/arch/x86/boot/bzImage
|
||||
$ ls $KERNEL/arch/x86/boot/bzImage
|
||||
$KERNEL/arch/x86/boot/bzImage
|
||||
```
|
||||
|
||||
|
@ -4,7 +4,7 @@ Besides regular system calls, a [syscall
|
||||
description](syscall_descriptions.md) file can also contain
|
||||
pseudo-syscalls. These are C functions defined in the
|
||||
executor. When a test program uses a pseudo-syscall, the executor
|
||||
will generate the pseudo-syscall function code in the resulting C program.
|
||||
will generate the pseudo-syscall function code in the resulting C program.
|
||||
|
||||
This allows a test program to have specific code blocks to perform
|
||||
certain actions, they may also be used as more test-friendly wrappers
|
||||
|
@ -170,7 +170,7 @@ close(r0)
|
||||
|
||||
Syscall arguments are always `in`, return values are `out` and pointer indirections
|
||||
have explicit direction as `ptr` type attribute. Also, it is possible to specify
|
||||
direction attribute individually for struct fields to account for more complex
|
||||
direction attribute individually for struct fields to account for more complex
|
||||
producer/consumer scenarious with structs that include both input/output resources.
|
||||
|
||||
<div id="values"/>
|
||||
|
@ -365,7 +365,7 @@ define MY_PATH_MAX PATH_MAX + 2
|
||||
## Misc
|
||||
|
||||
Description files also contain `include` directives that refer to Linux kernel header files,
|
||||
`incdir` directives that refer to custom Linux kernel header directories
|
||||
`incdir` directives that refer to custom Linux kernel header directories
|
||||
and `define` directives that define symbolic constant values.
|
||||
|
||||
The syzkaller executor defines some [pseudo system calls](./pseudo_syscalls.md)
|
||||
|
@ -176,7 +176,7 @@ Suggestions and patches that improve bisection quality for common cases are
|
||||
`syzbot` supports cause bisection (find the commit that introduces a bug) and
|
||||
fix bisection (find the commit that fixes a bug).
|
||||
|
||||
The web UI for a specific kernel
|
||||
The web UI for a specific kernel
|
||||
(say [upstream linux](https://syzkaller.appspot.com/upstream)) shows the
|
||||
`Bisected` status for all bugs.
|
||||
|
||||
@ -227,7 +227,7 @@ the provided crash report on the provided reproducer on a freshly-booted
|
||||
machine, so the reproducer worked for it somehow.
|
||||
|
||||
Note: if the report contains `userspace arch: i386`,
|
||||
then the program needs to be built with `-m32` flag.
|
||||
then the program needs to be built with `-m32` flag.
|
||||
|
||||
`syzbot` uses GCE VMs for testing, but *usually* it is not important.
|
||||
|
||||
@ -405,7 +405,7 @@ ask tree maintainers for priority handling.
|
||||
However, syzbot kernel config always includes `CONFIG_DEBUG_AID_FOR_SYZBOT=y` setting,
|
||||
which is not normally present in kernel. What was used for particularly elusive bugs in the past
|
||||
is temporary merging some additional debugging code into `linux-next` under this config setting
|
||||
(e.g. more debug checks and/or debug output) and waiting for new crash reports from syzbot.
|
||||
(e.g. more debug checks and/or debug output) and waiting for new crash reports from syzbot.
|
||||
|
||||
## Kernel configs
|
||||
|
||||
|
@ -151,7 +151,7 @@ using config along the lines of (substitute actual values for `$KERNEL`, `$SYZKA
|
||||
"ppoll",
|
||||
"dup3",
|
||||
"tkill",
|
||||
"gettid",
|
||||
"gettid",
|
||||
"close"
|
||||
]
|
||||
}
|
||||
|
31
tools/check-whitespace.sh
Executable file
31
tools/check-whitespace.sh
Executable file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright 2020 syzkaller project authors. All rights reserved.
|
||||
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
|
||||
|
||||
FILES=0
|
||||
FAILED=""
|
||||
RE="[[:space:]]$"
|
||||
LAST_EMPTY=""
|
||||
for F in $(find . -name "*.sh" -o -name "*.S" -o -name "*.py" -o -name "*.yml" -o -name "*.yaml" -o -name "*.md" | \
|
||||
egrep -v "/vendor/|/gen/"); do
|
||||
((FILES+=1))
|
||||
L=0
|
||||
while IFS= read -r LINE; do
|
||||
((L+=1))
|
||||
if [[ $LINE =~ $RE ]]; then
|
||||
echo "$F:$L:1: Trailing whitespace at the end of the line. Please remove."
|
||||
echo "$LINE"
|
||||
FAILED="1"
|
||||
fi
|
||||
LAST_EMPTY=""
|
||||
if [ "$LINE" == "" ]; then
|
||||
LAST_EMPTY="1"
|
||||
fi
|
||||
done < "$F"
|
||||
if [ "$LAST_EMPTY" != "" ]; then
|
||||
echo "$F:$L:1: Trailing empty line at the end of the file. Please remove."
|
||||
FAILED="1"
|
||||
fi
|
||||
done
|
||||
if [ "$FAILED" != "" ]; then exit 1; fi
|
||||
echo "$FILES files checked for whitespaces"
|
@ -22,7 +22,7 @@ for op1 in "${Op1[@]}"; do
|
||||
for op4 in "${Op4[@]}"; do
|
||||
echo mkfs.f2fs ${op1}${op2}${op3}${op4} disk.raw
|
||||
fallocate -l 64M disk.raw
|
||||
mkfs.f2fs "${op1}${op2}${op3}${op4}" disk.raw
|
||||
mkfs.f2fs "${op1}${op2}${op3}${op4}" disk.raw
|
||||
out="$dir/../sys/linux/test/syz_mount_image_f2fs_$dex"
|
||||
echo "# Code generated by tools/create_f2fs_image.sh. DO NOT EDIT." > $out
|
||||
echo "# requires: manual" >> $out
|
||||
@ -34,4 +34,3 @@ for op1 in "${Op1[@]}"; do
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user