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 --- tools/check-language.sh | 31 +++++++++++++++++++++++++++++++ tools/fops_probe/fops_probe.cc | 12 ++++++------ 2 files changed, 37 insertions(+), 6 deletions(-) create mode 100755 tools/check-language.sh (limited to 'tools') 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; -- cgit mrf-deployment