From 588020678f34b89925fcfbcaf8f635c5850e8e7a Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 11 Jun 2020 22:10:07 +0200 Subject: all: use more respective language Some terms are normalised on the technical level but may be oppressive on a societal level. Replace them with more technically neutral terms. See the following doc for a longer version: https://tools.ietf.org/id/draft-knodel-terminology-00.html --- Makefile | 7 +++-- dashboard/app/app_test.go | 4 +-- dashboard/app/bisect_test.go | 2 +- dashboard/app/config.go | 8 +++--- dashboard/app/entities.go | 4 +-- dashboard/app/jobs.go | 6 ++--- dashboard/app/jobs_test.go | 2 +- dashboard/config/kconfiglib-merge-usb-configs.py | 4 +-- dashboard/dashapi/dashapi.go | 8 +++--- docs/linux/setup.md | 4 +-- ...tup_ubuntu-host_odroid-c2-board_arm64-kernel.md | 2 +- executor/common_linux.h | 4 +-- executor/executor.cc | 4 +-- pkg/csource/generated.go | 4 +-- pkg/email/patch_test.go | 2 -- pkg/report/linux.go | 8 +++--- syz-ci/jobs.go | 6 ++--- syz-fuzzer/fuzzer.go | 8 +++--- tools/check-language.sh | 31 ++++++++++++++++++++++ tools/fops_probe/fops_probe.cc | 12 ++++----- vm/odroid/odroid.go | 24 ++++++++--------- 21 files changed, 93 insertions(+), 61 deletions(-) create mode 100755 tools/check-language.sh diff --git a/Makefile b/Makefile index b4572b337..0124fc64c 100644 --- a/Makefile +++ b/Makefile @@ -99,7 +99,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_links check_diff \ + tidy test test_race check_copyright check_language check_links check_diff \ arch arch_darwin_amd64_host arch_linux_amd64_host \ arch_freebsd_amd64_host arch_netbsd_amd64_host \ arch_linux_amd64_target arch_linux_386_target \ @@ -321,7 +321,7 @@ presubmit: presubmit_smoke: $(MAKE) generate - $(MAKE) -j100 check_diff check_copyright check_links presubmit_build + $(MAKE) -j100 check_diff check_copyright check_language check_links presubmit_build $(MAKE) test presubmit_build: @@ -394,6 +394,9 @@ install_prerequisites: check_copyright: ./tools/check-copyright.sh +check_language: + ./tools/check-language.sh + check_links: python ./tools/check_links.py $$(pwd) $$(ls ./*.md; find ./docs/ -name '*.md') diff --git a/dashboard/app/app_test.go b/dashboard/app/app_test.go index 6bf4cb64b..f825640f9 100644 --- a/dashboard/app/app_test.go +++ b/dashboard/app/app_test.go @@ -39,8 +39,8 @@ var testConfig = &GlobalConfig{ Clients: map[string]string{ "reporting": "reportingkeyreportingkeyreportingkey", }, - EmailBlacklist: []string{ - "\"Bar\" ", + EmailBlocklist: []string{ + "\"Bar\" ", }, Obsoleting: ObsoletingConfig{ MinPeriod: 80 * 24 * time.Hour, diff --git a/dashboard/app/bisect_test.go b/dashboard/app/bisect_test.go index 285b41355..d26b36d6a 100644 --- a/dashboard/app/bisect_test.go +++ b/dashboard/app/bisect_test.go @@ -563,7 +563,7 @@ func TestBisectWrong(t *testing.T) { case 4: flags = dashapi.BisectResultRelease case 5: - flags = dashapi.BisectResultBlacklist + flags = dashapi.BisectResultIgnore default: t.Fatalf("assign flags") } diff --git a/dashboard/app/config.go b/dashboard/app/config.go index ad295fc98..93f975a25 100644 --- a/dashboard/app/config.go +++ b/dashboard/app/config.go @@ -31,8 +31,8 @@ type GlobalConfig struct { CoverPath string // Global API clients that work across namespaces (e.g. external reporting). Clients map[string]string - // List of emails blacklisted from issuing test requests. - EmailBlacklist []string + // List of emails blocked from issuing test requests. + EmailBlocklist []string // Bug obsoleting settings. See ObsoletingConfig for details. Obsoleting ObsoletingConfig // Namespace that is shown by default (no namespace selected yet). @@ -225,8 +225,8 @@ func checkConfig(cfg *GlobalConfig) { if len(cfg.Namespaces) == 0 { panic("no namespaces found") } - for i := range cfg.EmailBlacklist { - cfg.EmailBlacklist[i] = email.CanonicalEmail(cfg.EmailBlacklist[i]) + for i := range cfg.EmailBlocklist { + cfg.EmailBlocklist[i] = email.CanonicalEmail(cfg.EmailBlocklist[i]) } namespaces := make(map[string]bool) clientNames := make(map[string]bool) diff --git a/dashboard/app/entities.go b/dashboard/app/entities.go index 549ebf282..dd0b79c1e 100644 --- a/dashboard/app/entities.go +++ b/dashboard/app/entities.go @@ -206,7 +206,7 @@ const ( BisectResultMerge JobFlags = 1 << iota BisectResultNoop BisectResultRelease - BisectResultBlacklist + BisectResultIgnore ) func (job *Job) isUnreliableBisect() bool { @@ -218,7 +218,7 @@ func (job *Job) isUnreliableBisect() bool { return job.Flags&BisectResultMerge != 0 || job.Flags&BisectResultNoop != 0 || job.Flags&BisectResultRelease != 0 || - job.Flags&BisectResultBlacklist != 0 + job.Flags&BisectResultIgnore != 0 } // Text holds text blobs (crash logs, reports, reproducers, etc). diff --git a/dashboard/app/jobs.go b/dashboard/app/jobs.go index 7e9e93e0b..831fbceea 100644 --- a/dashboard/app/jobs.go +++ b/dashboard/app/jobs.go @@ -24,9 +24,9 @@ func handleTestRequest(c context.Context, bugID, user, extID, link, patch, repo, jobCC []string) string { log.Infof(c, "test request: bug=%q user=%q extID=%q patch=%v, repo=%q branch=%q", bugID, user, extID, len(patch), repo, branch) - for _, blacklisted := range config.EmailBlacklist { - if user == blacklisted { - log.Errorf(c, "test request from blacklisted user: %v", user) + for _, blocked := range config.EmailBlocklist { + if user == blocked { + log.Errorf(c, "test request from blocked user: %v", user) return "" } } diff --git a/dashboard/app/jobs_test.go b/dashboard/app/jobs_test.go index 2f6e73cf7..a04c41e8a 100644 --- a/dashboard/app/jobs_test.go +++ b/dashboard/app/jobs_test.go @@ -74,7 +74,7 @@ func TestJob(t *testing.T) { c.expectEQ(strings.Contains(body, "does not look like a valid git repo"), true) c.incomingEmail(sender, "#syz test: git://git.git/git.git kernel-branch\n"+patch, - EmailOptFrom("\"foo\" ")) + EmailOptFrom("\"foo\" ")) c.expectNoEmail() pollResp := c.client2.pollJobs(build.Manager) c.expectEQ(pollResp.ID, "") diff --git a/dashboard/config/kconfiglib-merge-usb-configs.py b/dashboard/config/kconfiglib-merge-usb-configs.py index 7de27bf8b..e360f4baf 100755 --- a/dashboard/config/kconfiglib-merge-usb-configs.py +++ b/dashboard/config/kconfiglib-merge-usb-configs.py @@ -153,8 +153,8 @@ for name in to_disable: new_kconf.syms[name].set_value(0) # Remove testing related symbols. -blacklist = ['COMPILE_TEST'] -for sym in blacklist: +removelist = ['COMPILE_TEST'] +for sym in removelist: new_kconf.syms[sym].set_value(0) new_kconf.write_config() diff --git a/dashboard/dashapi/dashapi.go b/dashboard/dashapi/dashapi.go index ad1e1befa..e760a5ab5 100644 --- a/dashboard/dashapi/dashapi.go +++ b/dashboard/dashapi/dashapi.go @@ -177,10 +177,10 @@ const ( type JobDoneFlags int64 const ( - BisectResultMerge JobDoneFlags = 1 << iota // bisected to a merge commit - BisectResultNoop // commit does not affect resulting kernel binary - BisectResultRelease // commit is a kernel release - BisectResultBlacklist // commit is blacklisted, see syz-ci/jobs.go + BisectResultMerge JobDoneFlags = 1 << iota // bisected to a merge commit + BisectResultNoop // commit does not affect resulting kernel binary + BisectResultRelease // commit is a kernel release + BisectResultIgnore // this particular commit should be ignored, see syz-ci/jobs.go ) func (dash *Dashboard) JobPoll(req *JobPollReq) (*JobPollResp, error) { diff --git a/docs/linux/setup.md b/docs/linux/setup.md index 6ec732ba9..df6608bcb 100644 --- a/docs/linux/setup.md +++ b/docs/linux/setup.md @@ -80,8 +80,8 @@ See [this page](kernel_configs.md) for details. ### VM Setup -Syzkaller performs kernel fuzzing on slave virtual machines or physical devices. -These slave enviroments are referred to as VMs. +Syzkaller performs kernel fuzzing on worker virtual machines or physical devices. +These worker enviroments are referred to as VMs. Out-of-the-box syzkaller supports QEMU, kvmtool and GCE virtual machines, Android devices and Odroid C2 boards. These are the generic requirements for a syzkaller VM: diff --git a/docs/linux/setup_ubuntu-host_odroid-c2-board_arm64-kernel.md b/docs/linux/setup_ubuntu-host_odroid-c2-board_arm64-kernel.md index a5238207a..dfcd2eaa4 100644 --- a/docs/linux/setup_ubuntu-host_odroid-c2-board_arm64-kernel.md +++ b/docs/linux/setup_ubuntu-host_odroid-c2-board_arm64-kernel.md @@ -302,7 +302,7 @@ Use the following config: "type": "odroid", "vm": { "host_addr": "172.16.0.30", - "slave_addr": "172.16.0.31", + "device_addr": "172.16.0.31", "console": "/dev/ttyUSB0", "hub_bus": 3, "hub_device": 26, diff --git a/executor/common_linux.h b/executor/common_linux.h index b70729987..e4793f421 100644 --- a/executor/common_linux.h +++ b/executor/common_linux.h @@ -3496,13 +3496,13 @@ static void setup_kcsan() } #if SYZ_EXECUTOR // currently only used by executor -static void setup_kcsan_filterlist(char** frames, int nframes, bool blacklist) +static void setup_kcsan_filterlist(char** frames, int nframes, bool ignore) { int fd = open(KCSAN_DEBUGFS_FILE, O_WRONLY); if (fd == -1) fail("failed to open(\"%s\")", KCSAN_DEBUGFS_FILE); - const char* const filtertype = blacklist ? "blacklist" : "whitelist"; + const char* const filtertype = ignore ? "blacklist" : "whitelist"; printf("adding functions to KCSAN %s: ", filtertype); dprintf(fd, "%s\n", filtertype); for (int i = 0; i < nframes; ++i) { diff --git a/executor/executor.cc b/executor/executor.cc index 4e6a37055..bffd0cec2 100644 --- a/executor/executor.cc +++ b/executor/executor.cc @@ -344,9 +344,9 @@ int main(int argc, char** argv) #endif return 0; } - if (argc >= 2 && strcmp(argv[1], "setup_kcsan_blacklist") == 0) { + if (argc >= 2 && strcmp(argv[1], "setup_kcsan_filterlist") == 0) { #if SYZ_HAVE_KCSAN - setup_kcsan_filterlist(argv + 2, argc - 2, /*blacklist=*/true); + setup_kcsan_filterlist(argv + 2, argc - 2, /*ignore=*/true); #else fail("KCSAN is not implemented"); #endif diff --git a/pkg/csource/generated.go b/pkg/csource/generated.go index eaa2b714f..0d4219de6 100644 --- a/pkg/csource/generated.go +++ b/pkg/csource/generated.go @@ -8332,13 +8332,13 @@ static void setup_kcsan() } #if SYZ_EXECUTOR -static void setup_kcsan_filterlist(char** frames, int nframes, bool blacklist) +static void setup_kcsan_filterlist(char** frames, int nframes, bool ignore) { int fd = open(KCSAN_DEBUGFS_FILE, O_WRONLY); if (fd == -1) fail("failed to open(\"%s\")", KCSAN_DEBUGFS_FILE); - const char* const filtertype = blacklist ? "blacklist" : "whitelist"; + const char* const filtertype = ignore ? "blacklist" : "whitelist"; printf("adding functions to KCSAN %s: ", filtertype); dprintf(fd, "%s\n", filtertype); for (int i = 0; i < nframes; ++i) { diff --git a/pkg/email/patch_test.go b/pkg/email/patch_test.go index e34e60b64..0919db9ca 100644 --- a/pkg/email/patch_test.go +++ b/pkg/email/patch_test.go @@ -404,7 +404,6 @@ Index: usb-devel/drivers/usb/core/hub.c +++ usb-devel/drivers/usb/core/hub.c @@ -36,6 +36,10 @@ #include "hub.h" - #include "otg_whitelist.h" +#undef dev_dbg +#define dev_dbg dev_info @@ -452,7 +451,6 @@ Index: usb-devel/drivers/usb/core/hub.c +++ usb-devel/drivers/usb/core/hub.c @@ -36,6 +36,10 @@ #include "hub.h" - #include "otg_whitelist.h" +#undef dev_dbg +#define dev_dbg dev_info diff --git a/pkg/report/linux.go b/pkg/report/linux.go index 09b71a60f..aae212062 100644 --- a/pkg/report/linux.go +++ b/pkg/report/linux.go @@ -26,7 +26,7 @@ type linux struct { taskContext *regexp.Regexp cpuContext *regexp.Regexp questionableFrame *regexp.Regexp - guiltyFileBlacklist []*regexp.Regexp + guiltyFileIgnores []*regexp.Regexp reportStartIgnores []*regexp.Regexp infoMessagesWithStack [][]byte eoi []byte @@ -54,7 +54,7 @@ func ctorLinux(cfg *config) (Reporter, []string, error) { ctx.cpuContext = regexp.MustCompile(`\[ *C[0-9]+\]`) ctx.questionableFrame = regexp.MustCompile(`(\[\<[0-9a-f]+\>\])? \? `) ctx.eoi = []byte("") - ctx.guiltyFileBlacklist = []*regexp.Regexp{ + ctx.guiltyFileIgnores = []*regexp.Regexp{ regexp.MustCompile(`.*\.h`), regexp.MustCompile(`^lib/.*`), regexp.MustCompile(`^virt/lib/.*`), @@ -423,7 +423,7 @@ func (ctx *linux) extractGuiltyFile(rep *Report) string { if strings.HasPrefix(rep.Title, "INFO: rcu detected stall") { // Special case for rcu stalls. // There are too many frames that we want to skip before actual guilty frames, - // we would need to blacklist too many files and that would be fragile. + // we would need to ignore too many files and that would be fragile. // So instead we try to extract guilty file starting from the known // interrupt entry point first. if pos := bytes.Index(report, []byte(" apic_timer_interrupt+0x")); pos != -1 { @@ -439,7 +439,7 @@ func (ctx *linux) extractGuiltyFileImpl(report []byte) string { files := ctx.extractFiles(report) nextFile: for _, file := range files { - for _, re := range ctx.guiltyFileBlacklist { + for _, re := range ctx.guiltyFileIgnores { if re.MatchString(file) { continue nextFile } diff --git a/syz-ci/jobs.go b/syz-ci/jobs.go index 3a688d39a..6fa618bbd 100644 --- a/syz-ci/jobs.go +++ b/syz-ci/jobs.go @@ -422,15 +422,15 @@ func (jp *JobProcessor) bisect(job *Job, mgrcfg *mgrconfig.Config) error { if res.IsRelease { resp.Flags |= dashapi.BisectResultRelease } - blacklistedCommits := []string{ + ignoredCommits := []string{ // Commit "usb: gadget: add raw-gadget interface" adds a kernel interface for // triggering USB bugs, which ends up being the guilty commit during bisection // for USB bugs introduced before it. "f2c2e717642c66f7fe7e5dd69b2e8ff5849f4d10", } - for _, commit := range blacklistedCommits { + for _, commit := range ignoredCommits { if res.Commits[0].Hash == commit { - resp.Flags |= dashapi.BisectResultBlacklist + resp.Flags |= dashapi.BisectResultIgnore } } } diff --git a/syz-fuzzer/fuzzer.go b/syz-fuzzer/fuzzer.go index 9426adc65..6791393b2 100644 --- a/syz-fuzzer/fuzzer.go +++ b/syz-fuzzer/fuzzer.go @@ -272,7 +272,7 @@ func (fuzzer *Fuzzer) useBugFrames(r *rpctype.ConnectRes, flagProcs int) func() } if r.CheckResult.Features[host.FeatureKCSAN].Enabled && len(r.DataRaceFrames) != 0 { - fuzzer.blacklistDataRaceFrames(r.DataRaceFrames) + fuzzer.filterDataRaceFrames(r.DataRaceFrames) } return gateCallback @@ -302,11 +302,11 @@ func (fuzzer *Fuzzer) gateCallback(leakFrames []string) { } } -func (fuzzer *Fuzzer) blacklistDataRaceFrames(frames []string) { - args := append([]string{"setup_kcsan_blacklist"}, frames...) +func (fuzzer *Fuzzer) filterDataRaceFrames(frames []string) { + args := append([]string{"setup_kcsan_filterlist"}, frames...) output, err := osutil.RunCmd(10*time.Minute, "", fuzzer.config.Executor, args...) if err != nil { - log.Fatalf("failed to set KCSAN blacklist: %v", err) + log.Fatalf("failed to set KCSAN filterlist: %v", err) } log.Logf(0, "%s", output) } diff --git a/tools/check-language.sh b/tools/check-language.sh new file mode 100755 index 000000000..b99404be6 --- /dev/null +++ b/tools/check-language.sh @@ -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="" +shopt -s nocasematch +for F in $(find . -name "*.go" -o -name "*.sh" -o -name "*.cc" -o -name "*.md" \ + -o -name "*.S" -o -name "*.py" -o -name "*.yml" -o -name "*.yaml" | \ + egrep -v "/vendor/|/gen/|executor/syscalls.h|pkg/csource/generated.go|tools/check-language.sh"); do + ((FILES+=1)) + L=0 + while IFS= read -r LINE; do + ((L+=1)) + if [[ $LINE =~ (slave|blacklist|whitelist) ]]; then + if [[ $LINE =~ bond_enslave ]]; then + continue + fi + SUGGESTIONS="block/allow/ignore/skip" + if [[ $LINE =~ (slave) ]]; then + SUGGESTIONS="leader/follower/coordinator/worker/parent/helper" + fi + echo "$F:$L:1: Please use more respectful terminology, consider using ${SUGGESTIONS} instead." \ + "See https://tools.ietf.org/id/draft-knodel-terminology-00.html for more info." + echo "$LINE" + FAILED="1" + fi + done < "$F" +done +if [ "$FAILED" != "" ]; then exit 1; fi +echo "$FILES files checked" >&2 diff --git a/tools/fops_probe/fops_probe.cc b/tools/fops_probe/fops_probe.cc index c3c3332a6..1cbe886c1 100644 --- a/tools/fops_probe/fops_probe.cc +++ b/tools/fops_probe/fops_probe.cc @@ -55,7 +55,7 @@ typedef std::map kallsyms_map_t; static __attribute__((noreturn)) __attribute__((format(printf, 1, 2))) void failf(const char* msg, ...); static kallsyms_map_t read_kallsyms(); -static bool is_blacklisted(const std::string& sym); +static bool should_skip(const std::string& sym); static void probe_callback(uint64_t* cover, const kallsyms_map_t& kallsyms, const std::string& start_sym, std::function fn); @@ -102,16 +102,16 @@ void probe_callback(uint64_t* cover, const kallsyms_map_t& kallsyms, if (!started && sym != start_sym) continue; started = true; - if (!seen.insert(sym).second || is_blacklisted(sym)) + if (!seen.insert(sym).second || should_skip(sym)) continue; printf("%0llx %s\n", pc, sym.c_str()); } printf("\n"); } -bool is_blacklisted(const std::string& sym) +bool should_skip(const std::string& sym) { - static const char* blacklist[] = { + static const char* skip[] = { "security", "tomoyo", "selinux", @@ -125,8 +125,8 @@ bool is_blacklisted(const std::string& sym) "snprintf", "vsnprintf", }; - for (size_t i = 0; i < sizeof(blacklist) / sizeof(blacklist[0]); i++) { - if (!strncmp(sym.c_str(), blacklist[i], strlen(blacklist[i]))) + for (size_t i = 0; i < sizeof(skip) / sizeof(skip[0]); i++) { + if (!strncmp(sym.c_str(), skip[i], strlen(skip[i]))) return true; } return false; diff --git a/vm/odroid/odroid.go b/vm/odroid/odroid.go index 39fcf14aa..83d468439 100644 --- a/vm/odroid/odroid.go +++ b/vm/odroid/odroid.go @@ -33,12 +33,12 @@ func init() { } type Config struct { - Host_Addr string // ip address of the host machine - Slave_Addr string // ip address of the Odroid board - Console string // console device name (e.g. "/dev/ttyUSB0") - Hub_Bus int // host USB bus number for the USB hub - Hub_Device int // host USB device number for the USB hub - Hub_Port int // port on the USB hub to which Odroid is connected + Host_Addr string // ip address of the host machine + Device_Addr string // ip address of the Odroid board + Console string // console device name (e.g. "/dev/ttyUSB0") + Hub_Bus int // host USB bus number for the USB hub + Hub_Device int // host USB device number for the USB hub + Hub_Port int // port on the USB hub to which Odroid is connected } type Pool struct { @@ -62,8 +62,8 @@ func ctor(env *vmimpl.Env) (vmimpl.Pool, error) { if cfg.Host_Addr == "" { return nil, fmt.Errorf("config param host_addr is empty") } - if cfg.Slave_Addr == "" { - return nil, fmt.Errorf("config param slave_addr is empty") + if cfg.Device_Addr == "" { + return nil, fmt.Errorf("config param device_addr is empty") } if cfg.Console == "" { return nil, fmt.Errorf("config param console is empty") @@ -133,7 +133,7 @@ func (inst *instance) ssh(command string) ([]byte, error) { return nil, err } - args := append(vmimpl.SSHArgs(inst.debug, inst.sshkey, 22), "root@"+inst.cfg.Slave_Addr, command) + args := append(vmimpl.SSHArgs(inst.debug, inst.sshkey, 22), "root@"+inst.cfg.Device_Addr, command) if inst.debug { Logf(0, "running command: ssh %#v", args) } @@ -272,7 +272,7 @@ func (inst *instance) repair() error { } func (inst *instance) waitForSSH(timeout time.Duration) error { - return vmimpl.WaitForSSH(inst.debug, timeout, inst.cfg.Slave_Addr, inst.sshkey, "root", inst.os, 22) + return vmimpl.WaitForSSH(inst.debug, timeout, inst.cfg.Device_Addr, inst.sshkey, "root", inst.os, 22) } func (inst *instance) Close() { @@ -282,7 +282,7 @@ func (inst *instance) Close() { func (inst *instance) Copy(hostSrc string) (string, error) { basePath := "/data/" vmDst := filepath.Join(basePath, filepath.Base(hostSrc)) - args := append(vmimpl.SCPArgs(inst.debug, inst.sshkey, 22), hostSrc, "root@"+inst.cfg.Slave_Addr+":"+vmDst) + args := append(vmimpl.SCPArgs(inst.debug, inst.sshkey, 22), hostSrc, "root@"+inst.cfg.Device_Addr+":"+vmDst) cmd := osutil.Command("scp", args...) if inst.debug { Logf(0, "running command: scp %#v", args) @@ -322,7 +322,7 @@ func (inst *instance) Run(timeout time.Duration, stop <-chan bool, command strin } args := append(vmimpl.SSHArgs(inst.debug, inst.sshkey, 22), - "root@"+inst.cfg.Slave_Addr, "cd /data; "+command) + "root@"+inst.cfg.Device_Addr, "cd /data; "+command) if inst.debug { Logf(0, "running command: ssh %#v", args) } -- cgit mrf-deployment