diff options
Diffstat (limited to 'scripts')
44 files changed, 1306 insertions, 78 deletions
diff --git a/scripts/Makefile.gcc-plugins b/scripts/Makefile.gcc-plugins index 35042d96cf5d..5f7df50cfe7a 100644 --- a/scripts/Makefile.gcc-plugins +++ b/scripts/Makefile.gcc-plugins | |||
| @@ -15,6 +15,8 @@ gcc-plugin-$(CONFIG_GCC_PLUGIN_SANCOV) += sancov_plugin.so | |||
| 15 | gcc-plugin-$(CONFIG_GCC_PLUGIN_STRUCTLEAK) += structleak_plugin.so | 15 | gcc-plugin-$(CONFIG_GCC_PLUGIN_STRUCTLEAK) += structleak_plugin.so |
| 16 | gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_VERBOSE) \ | 16 | gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_VERBOSE) \ |
| 17 | += -fplugin-arg-structleak_plugin-verbose | 17 | += -fplugin-arg-structleak_plugin-verbose |
| 18 | gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF) \ | ||
| 19 | += -fplugin-arg-structleak_plugin-byref | ||
| 18 | gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL) \ | 20 | gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL) \ |
| 19 | += -fplugin-arg-structleak_plugin-byref-all | 21 | += -fplugin-arg-structleak_plugin-byref-all |
| 20 | gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK) \ | 22 | gcc-plugin-cflags-$(CONFIG_GCC_PLUGIN_STRUCTLEAK) \ |
diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan index 25c259df8ffa..6410bd22fe38 100644 --- a/scripts/Makefile.kasan +++ b/scripts/Makefile.kasan | |||
| @@ -26,15 +26,10 @@ else | |||
| 26 | CFLAGS_KASAN := $(CFLAGS_KASAN_SHADOW) \ | 26 | CFLAGS_KASAN := $(CFLAGS_KASAN_SHADOW) \ |
| 27 | $(call cc-param,asan-globals=1) \ | 27 | $(call cc-param,asan-globals=1) \ |
| 28 | $(call cc-param,asan-instrumentation-with-call-threshold=$(call_threshold)) \ | 28 | $(call cc-param,asan-instrumentation-with-call-threshold=$(call_threshold)) \ |
| 29 | $(call cc-param,asan-stack=1) \ | 29 | $(call cc-param,asan-stack=$(CONFIG_KASAN_STACK)) \ |
| 30 | $(call cc-param,asan-use-after-scope=1) \ | ||
| 31 | $(call cc-param,asan-instrument-allocas=1) | 30 | $(call cc-param,asan-instrument-allocas=1) |
| 32 | endif | 31 | endif |
| 33 | 32 | ||
| 34 | ifdef CONFIG_KASAN_EXTRA | ||
| 35 | CFLAGS_KASAN += $(call cc-option, -fsanitize-address-use-after-scope) | ||
| 36 | endif | ||
| 37 | |||
| 38 | endif # CONFIG_KASAN_GENERIC | 33 | endif # CONFIG_KASAN_GENERIC |
| 39 | 34 | ||
| 40 | ifdef CONFIG_KASAN_SW_TAGS | 35 | ifdef CONFIG_KASAN_SW_TAGS |
diff --git a/scripts/atomic/atomic-tbl.sh b/scripts/atomic/atomic-tbl.sh new file mode 100755 index 000000000000..81d5c32039dd --- /dev/null +++ b/scripts/atomic/atomic-tbl.sh | |||
| @@ -0,0 +1,186 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # SPDX-License-Identifier: GPL-2.0 | ||
| 3 | # helpers for dealing with atomics.tbl | ||
| 4 | |||
| 5 | #meta_in(meta, match) | ||
| 6 | meta_in() | ||
| 7 | { | ||
| 8 | case "$1" in | ||
| 9 | [$2]) return 0;; | ||
| 10 | esac | ||
| 11 | |||
| 12 | return 1 | ||
| 13 | } | ||
| 14 | |||
| 15 | #meta_has_ret(meta) | ||
| 16 | meta_has_ret() | ||
| 17 | { | ||
| 18 | meta_in "$1" "bBiIfFlR" | ||
| 19 | } | ||
| 20 | |||
| 21 | #meta_has_acquire(meta) | ||
| 22 | meta_has_acquire() | ||
| 23 | { | ||
| 24 | meta_in "$1" "BFIlR" | ||
| 25 | } | ||
| 26 | |||
| 27 | #meta_has_release(meta) | ||
| 28 | meta_has_release() | ||
| 29 | { | ||
| 30 | meta_in "$1" "BFIRs" | ||
| 31 | } | ||
| 32 | |||
| 33 | #meta_has_relaxed(meta) | ||
| 34 | meta_has_relaxed() | ||
| 35 | { | ||
| 36 | meta_in "$1" "BFIR" | ||
| 37 | } | ||
| 38 | |||
| 39 | #find_fallback_template(pfx, name, sfx, order) | ||
| 40 | find_fallback_template() | ||
| 41 | { | ||
| 42 | local pfx="$1"; shift | ||
| 43 | local name="$1"; shift | ||
| 44 | local sfx="$1"; shift | ||
| 45 | local order="$1"; shift | ||
| 46 | |||
| 47 | local base="" | ||
| 48 | local file="" | ||
| 49 | |||
| 50 | # We may have fallbacks for a specific case (e.g. read_acquire()), or | ||
| 51 | # an entire class, e.g. *inc*(). | ||
| 52 | # | ||
| 53 | # Start at the most specific, and fall back to the most general. Once | ||
| 54 | # we find a specific fallback, don't bother looking for more. | ||
| 55 | for base in "${pfx}${name}${sfx}${order}" "${name}"; do | ||
| 56 | file="${ATOMICDIR}/fallbacks/${base}" | ||
| 57 | |||
| 58 | if [ -f "${file}" ]; then | ||
| 59 | printf "${file}" | ||
| 60 | break | ||
| 61 | fi | ||
| 62 | done | ||
| 63 | } | ||
| 64 | |||
| 65 | #gen_ret_type(meta, int) | ||
| 66 | gen_ret_type() { | ||
| 67 | local meta="$1"; shift | ||
| 68 | local int="$1"; shift | ||
| 69 | |||
| 70 | case "${meta}" in | ||
| 71 | [sv]) printf "void";; | ||
| 72 | [bB]) printf "bool";; | ||
| 73 | [aiIfFlR]) printf "${int}";; | ||
| 74 | esac | ||
| 75 | } | ||
| 76 | |||
| 77 | #gen_ret_stmt(meta) | ||
| 78 | gen_ret_stmt() | ||
| 79 | { | ||
| 80 | if meta_has_ret "${meta}"; then | ||
| 81 | printf "return "; | ||
| 82 | fi | ||
| 83 | } | ||
| 84 | |||
| 85 | # gen_param_name(arg) | ||
| 86 | gen_param_name() | ||
| 87 | { | ||
| 88 | # strip off the leading 'c' for 'cv' | ||
| 89 | local name="${1#c}" | ||
| 90 | printf "${name#*:}" | ||
| 91 | } | ||
| 92 | |||
| 93 | # gen_param_type(arg, int, atomic) | ||
| 94 | gen_param_type() | ||
| 95 | { | ||
| 96 | local type="${1%%:*}"; shift | ||
| 97 | local int="$1"; shift | ||
| 98 | local atomic="$1"; shift | ||
| 99 | |||
| 100 | case "${type}" in | ||
| 101 | i) type="${int} ";; | ||
| 102 | p) type="${int} *";; | ||
| 103 | v) type="${atomic}_t *";; | ||
| 104 | cv) type="const ${atomic}_t *";; | ||
| 105 | esac | ||
| 106 | |||
| 107 | printf "${type}" | ||
| 108 | } | ||
| 109 | |||
| 110 | #gen_param(arg, int, atomic) | ||
| 111 | gen_param() | ||
| 112 | { | ||
| 113 | local arg="$1"; shift | ||
| 114 | local int="$1"; shift | ||
| 115 | local atomic="$1"; shift | ||
| 116 | local name="$(gen_param_name "${arg}")" | ||
| 117 | local type="$(gen_param_type "${arg}" "${int}" "${atomic}")" | ||
| 118 | |||
| 119 | printf "${type}${name}" | ||
| 120 | } | ||
| 121 | |||
| 122 | #gen_params(int, atomic, arg...) | ||
| 123 | gen_params() | ||
| 124 | { | ||
| 125 | local int="$1"; shift | ||
| 126 | local atomic="$1"; shift | ||
| 127 | |||
| 128 | while [ "$#" -gt 0 ]; do | ||
| 129 | gen_param "$1" "${int}" "${atomic}" | ||
| 130 | [ "$#" -gt 1 ] && printf ", " | ||
| 131 | shift; | ||
| 132 | done | ||
| 133 | } | ||
| 134 | |||
| 135 | #gen_args(arg...) | ||
| 136 | gen_args() | ||
| 137 | { | ||
| 138 | while [ "$#" -gt 0 ]; do | ||
| 139 | printf "$(gen_param_name "$1")" | ||
| 140 | [ "$#" -gt 1 ] && printf ", " | ||
| 141 | shift; | ||
| 142 | done | ||
| 143 | } | ||
| 144 | |||
| 145 | #gen_proto_order_variants(meta, pfx, name, sfx, ...) | ||
| 146 | gen_proto_order_variants() | ||
| 147 | { | ||
| 148 | local meta="$1"; shift | ||
| 149 | local pfx="$1"; shift | ||
| 150 | local name="$1"; shift | ||
| 151 | local sfx="$1"; shift | ||
| 152 | |||
| 153 | gen_proto_order_variant "${meta}" "${pfx}" "${name}" "${sfx}" "" "$@" | ||
| 154 | |||
| 155 | if meta_has_acquire "${meta}"; then | ||
| 156 | gen_proto_order_variant "${meta}" "${pfx}" "${name}" "${sfx}" "_acquire" "$@" | ||
| 157 | fi | ||
| 158 | if meta_has_release "${meta}"; then | ||
| 159 | gen_proto_order_variant "${meta}" "${pfx}" "${name}" "${sfx}" "_release" "$@" | ||
| 160 | fi | ||
| 161 | if meta_has_relaxed "${meta}"; then | ||
| 162 | gen_proto_order_variant "${meta}" "${pfx}" "${name}" "${sfx}" "_relaxed" "$@" | ||
| 163 | fi | ||
| 164 | } | ||
| 165 | |||
| 166 | #gen_proto_variants(meta, name, ...) | ||
| 167 | gen_proto_variants() | ||
| 168 | { | ||
| 169 | local meta="$1"; shift | ||
| 170 | local name="$1"; shift | ||
| 171 | local pfx="" | ||
| 172 | local sfx="" | ||
| 173 | |||
| 174 | meta_in "${meta}" "fF" && pfx="fetch_" | ||
| 175 | meta_in "${meta}" "R" && sfx="_return" | ||
| 176 | |||
| 177 | gen_proto_order_variants "${meta}" "${pfx}" "${name}" "${sfx}" "$@" | ||
| 178 | } | ||
| 179 | |||
| 180 | #gen_proto(meta, ...) | ||
| 181 | gen_proto() { | ||
| 182 | local meta="$1"; shift | ||
| 183 | for m in $(echo "${meta}" | grep -o .); do | ||
| 184 | gen_proto_variants "${m}" "$@" | ||
| 185 | done | ||
| 186 | } | ||
diff --git a/scripts/atomic/atomics.tbl b/scripts/atomic/atomics.tbl new file mode 100755 index 000000000000..fbee2f6190d9 --- /dev/null +++ b/scripts/atomic/atomics.tbl | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | # name meta args... | ||
| 2 | # | ||
| 3 | # Where meta contains a string of variants to generate. | ||
| 4 | # Upper-case implies _{acquire,release,relaxed} variants. | ||
| 5 | # Valid meta values are: | ||
| 6 | # * B/b - bool: returns bool | ||
| 7 | # * v - void: returns void | ||
| 8 | # * I/i - int: returns base type | ||
| 9 | # * R - return: returns base type (has _return variants) | ||
| 10 | # * F/f - fetch: returns base type (has fetch_ variants) | ||
| 11 | # * l - load: returns base type (has _acquire order variant) | ||
| 12 | # * s - store: returns void (has _release order variant) | ||
| 13 | # | ||
| 14 | # Where args contains list of type[:name], where type is: | ||
| 15 | # * cv - const pointer to atomic base type (atomic_t/atomic64_t/atomic_long_t) | ||
| 16 | # * v - pointer to atomic base type (atomic_t/atomic64_t/atomic_long_t) | ||
| 17 | # * i - base type (int/s64/long) | ||
| 18 | # * p - pointer to base type (int/s64/long) | ||
| 19 | # | ||
| 20 | read l cv | ||
| 21 | set s v i | ||
| 22 | add vRF i v | ||
| 23 | sub vRF i v | ||
| 24 | inc vRF v | ||
| 25 | dec vRF v | ||
| 26 | and vF i v | ||
| 27 | andnot vF i v | ||
| 28 | or vF i v | ||
| 29 | xor vF i v | ||
| 30 | xchg I v i | ||
| 31 | cmpxchg I v i:old i:new | ||
| 32 | try_cmpxchg B v p:old i:new | ||
| 33 | sub_and_test b i v | ||
| 34 | dec_and_test b v | ||
| 35 | inc_and_test b v | ||
| 36 | add_negative b i v | ||
| 37 | add_unless fb v i:a i:u | ||
| 38 | inc_not_zero b v | ||
| 39 | inc_unless_negative b v | ||
| 40 | dec_unless_positive b v | ||
| 41 | dec_if_positive i v | ||
diff --git a/scripts/atomic/check-atomics.sh b/scripts/atomic/check-atomics.sh new file mode 100755 index 000000000000..cfa0c2f71c84 --- /dev/null +++ b/scripts/atomic/check-atomics.sh | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # SPDX-License-Identifier: GPL-2.0 | ||
| 3 | # | ||
| 4 | # Check if atomic headers are up-to-date | ||
| 5 | |||
| 6 | ATOMICDIR=$(dirname $0) | ||
| 7 | ATOMICTBL=${ATOMICDIR}/atomics.tbl | ||
| 8 | LINUXDIR=${ATOMICDIR}/../.. | ||
| 9 | |||
| 10 | echo '' | sha1sum - > /dev/null 2>&1 | ||
| 11 | if [ $? -ne 0 ]; then | ||
| 12 | printf "sha1sum not available, skipping atomic header checks.\n" | ||
| 13 | exit 0 | ||
| 14 | fi | ||
| 15 | |||
| 16 | cat <<EOF | | ||
| 17 | asm-generic/atomic-instrumented.h | ||
| 18 | asm-generic/atomic-long.h | ||
| 19 | linux/atomic-fallback.h | ||
| 20 | EOF | ||
| 21 | while read header; do | ||
| 22 | OLDSUM="$(tail -n 1 ${LINUXDIR}/include/${header})" | ||
| 23 | OLDSUM="${OLDSUM#// }" | ||
| 24 | |||
| 25 | NEWSUM="$(head -n -1 ${LINUXDIR}/include/${header} | sha1sum)" | ||
| 26 | NEWSUM="${NEWSUM%% *}" | ||
| 27 | |||
| 28 | if [ "${OLDSUM}" != "${NEWSUM}" ]; then | ||
| 29 | printf "warning: generated include/${header} has been modified.\n" | ||
| 30 | fi | ||
| 31 | done | ||
| 32 | |||
| 33 | exit 0 | ||
diff --git a/scripts/atomic/fallbacks/acquire b/scripts/atomic/fallbacks/acquire new file mode 100755 index 000000000000..e38871e64db6 --- /dev/null +++ b/scripts/atomic/fallbacks/acquire | |||
| @@ -0,0 +1,9 @@ | |||
| 1 | cat <<EOF | ||
| 2 | static inline ${ret} | ||
| 3 | ${atomic}_${pfx}${name}${sfx}_acquire(${params}) | ||
| 4 | { | ||
| 5 | ${ret} ret = ${atomic}_${pfx}${name}${sfx}_relaxed(${args}); | ||
| 6 | __atomic_acquire_fence(); | ||
| 7 | return ret; | ||
| 8 | } | ||
| 9 | EOF | ||
diff --git a/scripts/atomic/fallbacks/add_negative b/scripts/atomic/fallbacks/add_negative new file mode 100755 index 000000000000..e6f4815637de --- /dev/null +++ b/scripts/atomic/fallbacks/add_negative | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | cat <<EOF | ||
| 2 | /** | ||
| 3 | * ${atomic}_add_negative - add and test if negative | ||
| 4 | * @i: integer value to add | ||
| 5 | * @v: pointer of type ${atomic}_t | ||
| 6 | * | ||
| 7 | * Atomically adds @i to @v and returns true | ||
| 8 | * if the result is negative, or false when | ||
| 9 | * result is greater than or equal to zero. | ||
| 10 | */ | ||
| 11 | static inline bool | ||
| 12 | ${atomic}_add_negative(${int} i, ${atomic}_t *v) | ||
| 13 | { | ||
| 14 | return ${atomic}_add_return(i, v) < 0; | ||
| 15 | } | ||
| 16 | EOF | ||
diff --git a/scripts/atomic/fallbacks/add_unless b/scripts/atomic/fallbacks/add_unless new file mode 100755 index 000000000000..792533885fbf --- /dev/null +++ b/scripts/atomic/fallbacks/add_unless | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | cat << EOF | ||
| 2 | /** | ||
| 3 | * ${atomic}_add_unless - add unless the number is already a given value | ||
| 4 | * @v: pointer of type ${atomic}_t | ||
| 5 | * @a: the amount to add to v... | ||
| 6 | * @u: ...unless v is equal to u. | ||
| 7 | * | ||
| 8 | * Atomically adds @a to @v, if @v was not already @u. | ||
| 9 | * Returns true if the addition was done. | ||
| 10 | */ | ||
| 11 | static inline bool | ||
| 12 | ${atomic}_add_unless(${atomic}_t *v, ${int} a, ${int} u) | ||
| 13 | { | ||
| 14 | return ${atomic}_fetch_add_unless(v, a, u) != u; | ||
| 15 | } | ||
| 16 | EOF | ||
diff --git a/scripts/atomic/fallbacks/andnot b/scripts/atomic/fallbacks/andnot new file mode 100755 index 000000000000..9f3a3216b5e3 --- /dev/null +++ b/scripts/atomic/fallbacks/andnot | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | cat <<EOF | ||
| 2 | static inline ${ret} | ||
| 3 | ${atomic}_${pfx}andnot${sfx}${order}(${int} i, ${atomic}_t *v) | ||
| 4 | { | ||
| 5 | ${retstmt}${atomic}_${pfx}and${sfx}${order}(~i, v); | ||
| 6 | } | ||
| 7 | EOF | ||
diff --git a/scripts/atomic/fallbacks/dec b/scripts/atomic/fallbacks/dec new file mode 100755 index 000000000000..10bbc82be31d --- /dev/null +++ b/scripts/atomic/fallbacks/dec | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | cat <<EOF | ||
| 2 | static inline ${ret} | ||
| 3 | ${atomic}_${pfx}dec${sfx}${order}(${atomic}_t *v) | ||
| 4 | { | ||
| 5 | ${retstmt}${atomic}_${pfx}sub${sfx}${order}(1, v); | ||
| 6 | } | ||
| 7 | EOF | ||
diff --git a/scripts/atomic/fallbacks/dec_and_test b/scripts/atomic/fallbacks/dec_and_test new file mode 100755 index 000000000000..0ce7103b3df2 --- /dev/null +++ b/scripts/atomic/fallbacks/dec_and_test | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | cat <<EOF | ||
| 2 | /** | ||
| 3 | * ${atomic}_dec_and_test - decrement and test | ||
| 4 | * @v: pointer of type ${atomic}_t | ||
| 5 | * | ||
| 6 | * Atomically decrements @v by 1 and | ||
| 7 | * returns true if the result is 0, or false for all other | ||
| 8 | * cases. | ||
| 9 | */ | ||
| 10 | static inline bool | ||
| 11 | ${atomic}_dec_and_test(${atomic}_t *v) | ||
| 12 | { | ||
| 13 | return ${atomic}_dec_return(v) == 0; | ||
| 14 | } | ||
| 15 | EOF | ||
diff --git a/scripts/atomic/fallbacks/dec_if_positive b/scripts/atomic/fallbacks/dec_if_positive new file mode 100755 index 000000000000..c52eacec43c8 --- /dev/null +++ b/scripts/atomic/fallbacks/dec_if_positive | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | cat <<EOF | ||
| 2 | static inline ${ret} | ||
| 3 | ${atomic}_dec_if_positive(${atomic}_t *v) | ||
| 4 | { | ||
| 5 | ${int} dec, c = ${atomic}_read(v); | ||
| 6 | |||
| 7 | do { | ||
| 8 | dec = c - 1; | ||
| 9 | if (unlikely(dec < 0)) | ||
| 10 | break; | ||
| 11 | } while (!${atomic}_try_cmpxchg(v, &c, dec)); | ||
| 12 | |||
| 13 | return dec; | ||
| 14 | } | ||
| 15 | EOF | ||
diff --git a/scripts/atomic/fallbacks/dec_unless_positive b/scripts/atomic/fallbacks/dec_unless_positive new file mode 100755 index 000000000000..8a2578f14268 --- /dev/null +++ b/scripts/atomic/fallbacks/dec_unless_positive | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | cat <<EOF | ||
| 2 | static inline bool | ||
| 3 | ${atomic}_dec_unless_positive(${atomic}_t *v) | ||
| 4 | { | ||
| 5 | ${int} c = ${atomic}_read(v); | ||
| 6 | |||
| 7 | do { | ||
| 8 | if (unlikely(c > 0)) | ||
| 9 | return false; | ||
| 10 | } while (!${atomic}_try_cmpxchg(v, &c, c - 1)); | ||
| 11 | |||
| 12 | return true; | ||
| 13 | } | ||
| 14 | EOF | ||
diff --git a/scripts/atomic/fallbacks/fence b/scripts/atomic/fallbacks/fence new file mode 100755 index 000000000000..82f68fa6931a --- /dev/null +++ b/scripts/atomic/fallbacks/fence | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | cat <<EOF | ||
| 2 | static inline ${ret} | ||
| 3 | ${atomic}_${pfx}${name}${sfx}(${params}) | ||
| 4 | { | ||
| 5 | ${ret} ret; | ||
| 6 | __atomic_pre_full_fence(); | ||
| 7 | ret = ${atomic}_${pfx}${name}${sfx}_relaxed(${args}); | ||
| 8 | __atomic_post_full_fence(); | ||
| 9 | return ret; | ||
| 10 | } | ||
| 11 | EOF | ||
diff --git a/scripts/atomic/fallbacks/fetch_add_unless b/scripts/atomic/fallbacks/fetch_add_unless new file mode 100755 index 000000000000..d2c091db7eae --- /dev/null +++ b/scripts/atomic/fallbacks/fetch_add_unless | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | cat << EOF | ||
| 2 | /** | ||
| 3 | * ${atomic}_fetch_add_unless - add unless the number is already a given value | ||
| 4 | * @v: pointer of type ${atomic}_t | ||
| 5 | * @a: the amount to add to v... | ||
| 6 | * @u: ...unless v is equal to u. | ||
| 7 | * | ||
| 8 | * Atomically adds @a to @v, so long as @v was not already @u. | ||
| 9 | * Returns original value of @v | ||
| 10 | */ | ||
| 11 | static inline ${int} | ||
| 12 | ${atomic}_fetch_add_unless(${atomic}_t *v, ${int} a, ${int} u) | ||
| 13 | { | ||
| 14 | ${int} c = ${atomic}_read(v); | ||
| 15 | |||
| 16 | do { | ||
| 17 | if (unlikely(c == u)) | ||
| 18 | break; | ||
| 19 | } while (!${atomic}_try_cmpxchg(v, &c, c + a)); | ||
| 20 | |||
| 21 | return c; | ||
| 22 | } | ||
| 23 | EOF | ||
diff --git a/scripts/atomic/fallbacks/inc b/scripts/atomic/fallbacks/inc new file mode 100755 index 000000000000..f866b3ad2353 --- /dev/null +++ b/scripts/atomic/fallbacks/inc | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | cat <<EOF | ||
| 2 | static inline ${ret} | ||
| 3 | ${atomic}_${pfx}inc${sfx}${order}(${atomic}_t *v) | ||
| 4 | { | ||
| 5 | ${retstmt}${atomic}_${pfx}add${sfx}${order}(1, v); | ||
| 6 | } | ||
| 7 | EOF | ||
diff --git a/scripts/atomic/fallbacks/inc_and_test b/scripts/atomic/fallbacks/inc_and_test new file mode 100755 index 000000000000..4e2068869f7e --- /dev/null +++ b/scripts/atomic/fallbacks/inc_and_test | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | cat <<EOF | ||
| 2 | /** | ||
| 3 | * ${atomic}_inc_and_test - increment and test | ||
| 4 | * @v: pointer of type ${atomic}_t | ||
| 5 | * | ||
| 6 | * Atomically increments @v by 1 | ||
| 7 | * and returns true if the result is zero, or false for all | ||
| 8 | * other cases. | ||
| 9 | */ | ||
| 10 | static inline bool | ||
| 11 | ${atomic}_inc_and_test(${atomic}_t *v) | ||
| 12 | { | ||
| 13 | return ${atomic}_inc_return(v) == 0; | ||
| 14 | } | ||
| 15 | EOF | ||
diff --git a/scripts/atomic/fallbacks/inc_not_zero b/scripts/atomic/fallbacks/inc_not_zero new file mode 100755 index 000000000000..a7c45c8d107c --- /dev/null +++ b/scripts/atomic/fallbacks/inc_not_zero | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | cat <<EOF | ||
| 2 | /** | ||
| 3 | * ${atomic}_inc_not_zero - increment unless the number is zero | ||
| 4 | * @v: pointer of type ${atomic}_t | ||
| 5 | * | ||
| 6 | * Atomically increments @v by 1, if @v is non-zero. | ||
| 7 | * Returns true if the increment was done. | ||
| 8 | */ | ||
| 9 | static inline bool | ||
| 10 | ${atomic}_inc_not_zero(${atomic}_t *v) | ||
| 11 | { | ||
| 12 | return ${atomic}_add_unless(v, 1, 0); | ||
| 13 | } | ||
| 14 | EOF | ||
diff --git a/scripts/atomic/fallbacks/inc_unless_negative b/scripts/atomic/fallbacks/inc_unless_negative new file mode 100755 index 000000000000..0c266e71dbd4 --- /dev/null +++ b/scripts/atomic/fallbacks/inc_unless_negative | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | cat <<EOF | ||
| 2 | static inline bool | ||
| 3 | ${atomic}_inc_unless_negative(${atomic}_t *v) | ||
| 4 | { | ||
| 5 | ${int} c = ${atomic}_read(v); | ||
| 6 | |||
| 7 | do { | ||
| 8 | if (unlikely(c < 0)) | ||
| 9 | return false; | ||
| 10 | } while (!${atomic}_try_cmpxchg(v, &c, c + 1)); | ||
| 11 | |||
| 12 | return true; | ||
| 13 | } | ||
| 14 | EOF | ||
diff --git a/scripts/atomic/fallbacks/read_acquire b/scripts/atomic/fallbacks/read_acquire new file mode 100755 index 000000000000..75863b5203f7 --- /dev/null +++ b/scripts/atomic/fallbacks/read_acquire | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | cat <<EOF | ||
| 2 | static inline ${ret} | ||
| 3 | ${atomic}_read_acquire(const ${atomic}_t *v) | ||
| 4 | { | ||
| 5 | return smp_load_acquire(&(v)->counter); | ||
| 6 | } | ||
| 7 | EOF | ||
diff --git a/scripts/atomic/fallbacks/release b/scripts/atomic/fallbacks/release new file mode 100755 index 000000000000..3f628a3802d9 --- /dev/null +++ b/scripts/atomic/fallbacks/release | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | cat <<EOF | ||
| 2 | static inline ${ret} | ||
| 3 | ${atomic}_${pfx}${name}${sfx}_release(${params}) | ||
| 4 | { | ||
| 5 | __atomic_release_fence(); | ||
| 6 | ${retstmt}${atomic}_${pfx}${name}${sfx}_relaxed(${args}); | ||
| 7 | } | ||
| 8 | EOF | ||
diff --git a/scripts/atomic/fallbacks/set_release b/scripts/atomic/fallbacks/set_release new file mode 100755 index 000000000000..45bb5e0cfc08 --- /dev/null +++ b/scripts/atomic/fallbacks/set_release | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | cat <<EOF | ||
| 2 | static inline void | ||
| 3 | ${atomic}_set_release(${atomic}_t *v, ${int} i) | ||
| 4 | { | ||
| 5 | smp_store_release(&(v)->counter, i); | ||
| 6 | } | ||
| 7 | EOF | ||
diff --git a/scripts/atomic/fallbacks/sub_and_test b/scripts/atomic/fallbacks/sub_and_test new file mode 100755 index 000000000000..289ef17a2d7a --- /dev/null +++ b/scripts/atomic/fallbacks/sub_and_test | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | cat <<EOF | ||
| 2 | /** | ||
| 3 | * ${atomic}_sub_and_test - subtract value from variable and test result | ||
| 4 | * @i: integer value to subtract | ||
| 5 | * @v: pointer of type ${atomic}_t | ||
| 6 | * | ||
| 7 | * Atomically subtracts @i from @v and returns | ||
| 8 | * true if the result is zero, or false for all | ||
| 9 | * other cases. | ||
| 10 | */ | ||
| 11 | static inline bool | ||
| 12 | ${atomic}_sub_and_test(${int} i, ${atomic}_t *v) | ||
| 13 | { | ||
| 14 | return ${atomic}_sub_return(i, v) == 0; | ||
| 15 | } | ||
| 16 | EOF | ||
diff --git a/scripts/atomic/fallbacks/try_cmpxchg b/scripts/atomic/fallbacks/try_cmpxchg new file mode 100755 index 000000000000..4ed85e2f5378 --- /dev/null +++ b/scripts/atomic/fallbacks/try_cmpxchg | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | cat <<EOF | ||
| 2 | static inline bool | ||
| 3 | ${atomic}_try_cmpxchg${order}(${atomic}_t *v, ${int} *old, ${int} new) | ||
| 4 | { | ||
| 5 | ${int} r, o = *old; | ||
| 6 | r = ${atomic}_cmpxchg${order}(v, o, new); | ||
| 7 | if (unlikely(r != o)) | ||
| 8 | *old = r; | ||
| 9 | return likely(r == o); | ||
| 10 | } | ||
| 11 | EOF | ||
diff --git a/scripts/atomic/gen-atomic-fallback.sh b/scripts/atomic/gen-atomic-fallback.sh new file mode 100755 index 000000000000..1bd7c1707633 --- /dev/null +++ b/scripts/atomic/gen-atomic-fallback.sh | |||
| @@ -0,0 +1,181 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # SPDX-License-Identifier: GPL-2.0 | ||
| 3 | |||
| 4 | ATOMICDIR=$(dirname $0) | ||
| 5 | |||
| 6 | . ${ATOMICDIR}/atomic-tbl.sh | ||
| 7 | |||
| 8 | #gen_template_fallback(template, meta, pfx, name, sfx, order, atomic, int, args...) | ||
| 9 | gen_template_fallback() | ||
| 10 | { | ||
| 11 | local template="$1"; shift | ||
| 12 | local meta="$1"; shift | ||
| 13 | local pfx="$1"; shift | ||
| 14 | local name="$1"; shift | ||
| 15 | local sfx="$1"; shift | ||
| 16 | local order="$1"; shift | ||
| 17 | local atomic="$1"; shift | ||
| 18 | local int="$1"; shift | ||
| 19 | |||
| 20 | local atomicname="${atomic}_${pfx}${name}${sfx}${order}" | ||
| 21 | |||
| 22 | local ret="$(gen_ret_type "${meta}" "${int}")" | ||
| 23 | local retstmt="$(gen_ret_stmt "${meta}")" | ||
| 24 | local params="$(gen_params "${int}" "${atomic}" "$@")" | ||
| 25 | local args="$(gen_args "$@")" | ||
| 26 | |||
| 27 | if [ ! -z "${template}" ]; then | ||
| 28 | printf "#ifndef ${atomicname}\n" | ||
| 29 | . ${template} | ||
| 30 | printf "#define ${atomicname} ${atomicname}\n" | ||
| 31 | printf "#endif\n\n" | ||
| 32 | fi | ||
| 33 | } | ||
| 34 | |||
| 35 | #gen_proto_fallback(meta, pfx, name, sfx, order, atomic, int, args...) | ||
| 36 | gen_proto_fallback() | ||
| 37 | { | ||
| 38 | local meta="$1"; shift | ||
| 39 | local pfx="$1"; shift | ||
| 40 | local name="$1"; shift | ||
| 41 | local sfx="$1"; shift | ||
| 42 | local order="$1"; shift | ||
| 43 | |||
| 44 | local tmpl="$(find_fallback_template "${pfx}" "${name}" "${sfx}" "${order}")" | ||
| 45 | gen_template_fallback "${tmpl}" "${meta}" "${pfx}" "${name}" "${sfx}" "${order}" "$@" | ||
| 46 | } | ||
| 47 | |||
| 48 | #gen_basic_fallbacks(basename) | ||
| 49 | gen_basic_fallbacks() | ||
| 50 | { | ||
| 51 | local basename="$1"; shift | ||
| 52 | cat << EOF | ||
| 53 | #define ${basename}_acquire ${basename} | ||
| 54 | #define ${basename}_release ${basename} | ||
| 55 | #define ${basename}_relaxed ${basename} | ||
| 56 | EOF | ||
| 57 | } | ||
| 58 | |||
| 59 | #gen_proto_order_variants(meta, pfx, name, sfx, atomic, int, args...) | ||
| 60 | gen_proto_order_variants() | ||
| 61 | { | ||
| 62 | local meta="$1"; shift | ||
| 63 | local pfx="$1"; shift | ||
| 64 | local name="$1"; shift | ||
| 65 | local sfx="$1"; shift | ||
| 66 | local atomic="$1" | ||
| 67 | |||
| 68 | local basename="${atomic}_${pfx}${name}${sfx}" | ||
| 69 | |||
| 70 | local template="$(find_fallback_template "${pfx}" "${name}" "${sfx}" "${order}")" | ||
| 71 | |||
| 72 | # If we don't have relaxed atomics, then we don't bother with ordering fallbacks | ||
| 73 | # read_acquire and set_release need to be templated, though | ||
| 74 | if ! meta_has_relaxed "${meta}"; then | ||
| 75 | gen_proto_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "" "$@" | ||
| 76 | |||
| 77 | if meta_has_acquire "${meta}"; then | ||
| 78 | gen_proto_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "_acquire" "$@" | ||
| 79 | fi | ||
| 80 | |||
| 81 | if meta_has_release "${meta}"; then | ||
| 82 | gen_proto_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "_release" "$@" | ||
| 83 | fi | ||
| 84 | |||
| 85 | return | ||
| 86 | fi | ||
| 87 | |||
| 88 | printf "#ifndef ${basename}_relaxed\n" | ||
| 89 | |||
| 90 | if [ ! -z "${template}" ]; then | ||
| 91 | printf "#ifdef ${basename}\n" | ||
| 92 | fi | ||
| 93 | |||
| 94 | gen_basic_fallbacks "${basename}" | ||
| 95 | |||
| 96 | if [ ! -z "${template}" ]; then | ||
| 97 | printf "#endif /* ${atomic}_${pfx}${name}${sfx} */\n\n" | ||
| 98 | gen_proto_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "" "$@" | ||
| 99 | gen_proto_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "_acquire" "$@" | ||
| 100 | gen_proto_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "_release" "$@" | ||
| 101 | gen_proto_fallback "${meta}" "${pfx}" "${name}" "${sfx}" "_relaxed" "$@" | ||
| 102 | fi | ||
| 103 | |||
| 104 | printf "#else /* ${basename}_relaxed */\n\n" | ||
| 105 | |||
| 106 | gen_template_fallback "${ATOMICDIR}/fallbacks/acquire" "${meta}" "${pfx}" "${name}" "${sfx}" "_acquire" "$@" | ||
| 107 | gen_template_fallback "${ATOMICDIR}/fallbacks/release" "${meta}" "${pfx}" "${name}" "${sfx}" "_release" "$@" | ||
| 108 | gen_template_fallback "${ATOMICDIR}/fallbacks/fence" "${meta}" "${pfx}" "${name}" "${sfx}" "" "$@" | ||
| 109 | |||
| 110 | printf "#endif /* ${basename}_relaxed */\n\n" | ||
| 111 | } | ||
| 112 | |||
| 113 | gen_xchg_fallbacks() | ||
| 114 | { | ||
| 115 | local xchg="$1"; shift | ||
| 116 | cat <<EOF | ||
| 117 | #ifndef ${xchg}_relaxed | ||
| 118 | #define ${xchg}_relaxed ${xchg} | ||
| 119 | #define ${xchg}_acquire ${xchg} | ||
| 120 | #define ${xchg}_release ${xchg} | ||
| 121 | #else /* ${xchg}_relaxed */ | ||
| 122 | |||
| 123 | #ifndef ${xchg}_acquire | ||
| 124 | #define ${xchg}_acquire(...) \\ | ||
| 125 | __atomic_op_acquire(${xchg}, __VA_ARGS__) | ||
| 126 | #endif | ||
| 127 | |||
| 128 | #ifndef ${xchg}_release | ||
| 129 | #define ${xchg}_release(...) \\ | ||
| 130 | __atomic_op_release(${xchg}, __VA_ARGS__) | ||
| 131 | #endif | ||
| 132 | |||
| 133 | #ifndef ${xchg} | ||
| 134 | #define ${xchg}(...) \\ | ||
| 135 | __atomic_op_fence(${xchg}, __VA_ARGS__) | ||
| 136 | #endif | ||
| 137 | |||
| 138 | #endif /* ${xchg}_relaxed */ | ||
| 139 | |||
| 140 | EOF | ||
| 141 | } | ||
| 142 | |||
| 143 | cat << EOF | ||
| 144 | // SPDX-License-Identifier: GPL-2.0 | ||
| 145 | |||
| 146 | // Generated by $0 | ||
| 147 | // DO NOT MODIFY THIS FILE DIRECTLY | ||
| 148 | |||
| 149 | #ifndef _LINUX_ATOMIC_FALLBACK_H | ||
| 150 | #define _LINUX_ATOMIC_FALLBACK_H | ||
| 151 | |||
| 152 | EOF | ||
| 153 | |||
| 154 | for xchg in "xchg" "cmpxchg" "cmpxchg64"; do | ||
| 155 | gen_xchg_fallbacks "${xchg}" | ||
| 156 | done | ||
| 157 | |||
| 158 | grep '^[a-z]' "$1" | while read name meta args; do | ||
| 159 | gen_proto "${meta}" "${name}" "atomic" "int" ${args} | ||
| 160 | done | ||
| 161 | |||
| 162 | cat <<EOF | ||
| 163 | #define atomic_cond_read_acquire(v, c) smp_cond_load_acquire(&(v)->counter, (c)) | ||
| 164 | #define atomic_cond_read_relaxed(v, c) smp_cond_load_relaxed(&(v)->counter, (c)) | ||
| 165 | |||
| 166 | #ifdef CONFIG_GENERIC_ATOMIC64 | ||
| 167 | #include <asm-generic/atomic64.h> | ||
| 168 | #endif | ||
| 169 | |||
| 170 | EOF | ||
| 171 | |||
| 172 | grep '^[a-z]' "$1" | while read name meta args; do | ||
| 173 | gen_proto "${meta}" "${name}" "atomic64" "s64" ${args} | ||
| 174 | done | ||
| 175 | |||
| 176 | cat <<EOF | ||
| 177 | #define atomic64_cond_read_acquire(v, c) smp_cond_load_acquire(&(v)->counter, (c)) | ||
| 178 | #define atomic64_cond_read_relaxed(v, c) smp_cond_load_relaxed(&(v)->counter, (c)) | ||
| 179 | |||
| 180 | #endif /* _LINUX_ATOMIC_FALLBACK_H */ | ||
| 181 | EOF | ||
diff --git a/scripts/atomic/gen-atomic-instrumented.sh b/scripts/atomic/gen-atomic-instrumented.sh new file mode 100755 index 000000000000..e09812372b17 --- /dev/null +++ b/scripts/atomic/gen-atomic-instrumented.sh | |||
| @@ -0,0 +1,182 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # SPDX-License-Identifier: GPL-2.0 | ||
| 3 | |||
| 4 | ATOMICDIR=$(dirname $0) | ||
| 5 | |||
| 6 | . ${ATOMICDIR}/atomic-tbl.sh | ||
| 7 | |||
| 8 | #gen_param_check(arg) | ||
| 9 | gen_param_check() | ||
| 10 | { | ||
| 11 | local arg="$1"; shift | ||
| 12 | local type="${arg%%:*}" | ||
| 13 | local name="$(gen_param_name "${arg}")" | ||
| 14 | local rw="write" | ||
| 15 | |||
| 16 | case "${type#c}" in | ||
| 17 | i) return;; | ||
| 18 | esac | ||
| 19 | |||
| 20 | # We don't write to constant parameters | ||
| 21 | [ ${type#c} != ${type} ] && rw="read" | ||
| 22 | |||
| 23 | printf "\tkasan_check_${rw}(${name}, sizeof(*${name}));\n" | ||
| 24 | } | ||
| 25 | |||
| 26 | #gen_param_check(arg...) | ||
| 27 | gen_params_checks() | ||
| 28 | { | ||
| 29 | while [ "$#" -gt 0 ]; do | ||
| 30 | gen_param_check "$1" | ||
| 31 | shift; | ||
| 32 | done | ||
| 33 | } | ||
| 34 | |||
| 35 | # gen_guard(meta, atomic, pfx, name, sfx, order) | ||
| 36 | gen_guard() | ||
| 37 | { | ||
| 38 | local meta="$1"; shift | ||
| 39 | local atomic="$1"; shift | ||
| 40 | local pfx="$1"; shift | ||
| 41 | local name="$1"; shift | ||
| 42 | local sfx="$1"; shift | ||
| 43 | local order="$1"; shift | ||
| 44 | |||
| 45 | local atomicname="arch_${atomic}_${pfx}${name}${sfx}${order}" | ||
| 46 | |||
| 47 | local template="$(find_fallback_template "${pfx}" "${name}" "${sfx}" "${order}")" | ||
| 48 | |||
| 49 | # We definitely need a preprocessor symbol for this atomic if it is an | ||
| 50 | # ordering variant, or if there's a generic fallback. | ||
| 51 | if [ ! -z "${order}" ] || [ ! -z "${template}" ]; then | ||
| 52 | printf "defined(${atomicname})" | ||
| 53 | return | ||
| 54 | fi | ||
| 55 | |||
| 56 | # If this is a base variant, but a relaxed variant *may* exist, then we | ||
| 57 | # only have a preprocessor symbol if the relaxed variant isn't defined | ||
| 58 | if meta_has_relaxed "${meta}"; then | ||
| 59 | printf "!defined(${atomicname}_relaxed) || defined(${atomicname})" | ||
| 60 | fi | ||
| 61 | } | ||
| 62 | |||
| 63 | #gen_proto_order_variant(meta, pfx, name, sfx, order, atomic, int, arg...) | ||
| 64 | gen_proto_order_variant() | ||
| 65 | { | ||
| 66 | local meta="$1"; shift | ||
| 67 | local pfx="$1"; shift | ||
| 68 | local name="$1"; shift | ||
| 69 | local sfx="$1"; shift | ||
| 70 | local order="$1"; shift | ||
| 71 | local atomic="$1"; shift | ||
| 72 | local int="$1"; shift | ||
| 73 | |||
| 74 | local atomicname="${atomic}_${pfx}${name}${sfx}${order}" | ||
| 75 | |||
| 76 | local guard="$(gen_guard "${meta}" "${atomic}" "${pfx}" "${name}" "${sfx}" "${order}")" | ||
| 77 | |||
| 78 | local ret="$(gen_ret_type "${meta}" "${int}")" | ||
| 79 | local params="$(gen_params "${int}" "${atomic}" "$@")" | ||
| 80 | local checks="$(gen_params_checks "$@")" | ||
| 81 | local args="$(gen_args "$@")" | ||
| 82 | local retstmt="$(gen_ret_stmt "${meta}")" | ||
| 83 | |||
| 84 | [ ! -z "${guard}" ] && printf "#if ${guard}\n" | ||
| 85 | |||
| 86 | cat <<EOF | ||
| 87 | static inline ${ret} | ||
| 88 | ${atomicname}(${params}) | ||
| 89 | { | ||
| 90 | ${checks} | ||
| 91 | ${retstmt}arch_${atomicname}(${args}); | ||
| 92 | } | ||
| 93 | #define ${atomicname} ${atomicname} | ||
| 94 | EOF | ||
| 95 | |||
| 96 | [ ! -z "${guard}" ] && printf "#endif\n" | ||
| 97 | |||
| 98 | printf "\n" | ||
| 99 | } | ||
| 100 | |||
| 101 | gen_xchg() | ||
| 102 | { | ||
| 103 | local xchg="$1"; shift | ||
| 104 | local mult="$1"; shift | ||
| 105 | |||
| 106 | cat <<EOF | ||
| 107 | #define ${xchg}(ptr, ...) \\ | ||
| 108 | ({ \\ | ||
| 109 | typeof(ptr) __ai_ptr = (ptr); \\ | ||
| 110 | kasan_check_write(__ai_ptr, ${mult}sizeof(*__ai_ptr)); \\ | ||
| 111 | arch_${xchg}(__ai_ptr, __VA_ARGS__); \\ | ||
| 112 | }) | ||
| 113 | EOF | ||
| 114 | } | ||
| 115 | |||
| 116 | gen_optional_xchg() | ||
| 117 | { | ||
| 118 | local name="$1"; shift | ||
| 119 | local sfx="$1"; shift | ||
| 120 | local guard="defined(arch_${name}${sfx})" | ||
| 121 | |||
| 122 | [ -z "${sfx}" ] && guard="!defined(arch_${name}_relaxed) || defined(arch_${name})" | ||
| 123 | |||
| 124 | printf "#if ${guard}\n" | ||
| 125 | gen_xchg "${name}${sfx}" "" | ||
| 126 | printf "#endif\n\n" | ||
| 127 | } | ||
| 128 | |||
| 129 | cat << EOF | ||
| 130 | // SPDX-License-Identifier: GPL-2.0 | ||
| 131 | |||
| 132 | // Generated by $0 | ||
| 133 | // DO NOT MODIFY THIS FILE DIRECTLY | ||
| 134 | |||
| 135 | /* | ||
| 136 | * This file provides wrappers with KASAN instrumentation for atomic operations. | ||
| 137 | * To use this functionality an arch's atomic.h file needs to define all | ||
| 138 | * atomic operations with arch_ prefix (e.g. arch_atomic_read()) and include | ||
| 139 | * this file at the end. This file provides atomic_read() that forwards to | ||
| 140 | * arch_atomic_read() for actual atomic operation. | ||
| 141 | * Note: if an arch atomic operation is implemented by means of other atomic | ||
| 142 | * operations (e.g. atomic_read()/atomic_cmpxchg() loop), then it needs to use | ||
| 143 | * arch_ variants (i.e. arch_atomic_read()/arch_atomic_cmpxchg()) to avoid | ||
| 144 | * double instrumentation. | ||
| 145 | */ | ||
| 146 | #ifndef _ASM_GENERIC_ATOMIC_INSTRUMENTED_H | ||
| 147 | #define _ASM_GENERIC_ATOMIC_INSTRUMENTED_H | ||
| 148 | |||
| 149 | #include <linux/build_bug.h> | ||
| 150 | #include <linux/kasan-checks.h> | ||
| 151 | |||
| 152 | EOF | ||
| 153 | |||
| 154 | grep '^[a-z]' "$1" | while read name meta args; do | ||
| 155 | gen_proto "${meta}" "${name}" "atomic" "int" ${args} | ||
| 156 | done | ||
| 157 | |||
| 158 | grep '^[a-z]' "$1" | while read name meta args; do | ||
| 159 | gen_proto "${meta}" "${name}" "atomic64" "s64" ${args} | ||
| 160 | done | ||
| 161 | |||
| 162 | for xchg in "xchg" "cmpxchg" "cmpxchg64"; do | ||
| 163 | for order in "" "_acquire" "_release" "_relaxed"; do | ||
| 164 | gen_optional_xchg "${xchg}" "${order}" | ||
| 165 | done | ||
| 166 | done | ||
| 167 | |||
| 168 | for xchg in "cmpxchg_local" "cmpxchg64_local" "sync_cmpxchg"; do | ||
| 169 | gen_xchg "${xchg}" "" | ||
| 170 | printf "\n" | ||
| 171 | done | ||
| 172 | |||
| 173 | gen_xchg "cmpxchg_double" "2 * " | ||
| 174 | |||
| 175 | printf "\n\n" | ||
| 176 | |||
| 177 | gen_xchg "cmpxchg_double_local" "2 * " | ||
| 178 | |||
| 179 | cat <<EOF | ||
| 180 | |||
| 181 | #endif /* _ASM_GENERIC_ATOMIC_INSTRUMENTED_H */ | ||
| 182 | EOF | ||
diff --git a/scripts/atomic/gen-atomic-long.sh b/scripts/atomic/gen-atomic-long.sh new file mode 100755 index 000000000000..c240a7231b2e --- /dev/null +++ b/scripts/atomic/gen-atomic-long.sh | |||
| @@ -0,0 +1,101 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # SPDX-License-Identifier: GPL-2.0 | ||
| 3 | |||
| 4 | ATOMICDIR=$(dirname $0) | ||
| 5 | |||
| 6 | . ${ATOMICDIR}/atomic-tbl.sh | ||
| 7 | |||
| 8 | #gen_cast(arg, int, atomic) | ||
| 9 | gen_cast() | ||
| 10 | { | ||
| 11 | local arg="$1"; shift | ||
| 12 | local int="$1"; shift | ||
| 13 | local atomic="$1"; shift | ||
| 14 | |||
| 15 | [ "${arg%%:*}" = "p" ] || return | ||
| 16 | |||
| 17 | printf "($(gen_param_type "${arg}" "${int}" "${atomic}"))" | ||
| 18 | } | ||
| 19 | |||
| 20 | #gen_args_cast(int, atomic, arg...) | ||
| 21 | gen_args_cast() | ||
| 22 | { | ||
| 23 | local int="$1"; shift | ||
| 24 | local atomic="$1"; shift | ||
| 25 | |||
| 26 | while [ "$#" -gt 0 ]; do | ||
| 27 | local cast="$(gen_cast "$1" "${int}" "${atomic}")" | ||
| 28 | local arg="$(gen_param_name "$1")" | ||
| 29 | printf "${cast}${arg}" | ||
| 30 | [ "$#" -gt 1 ] && printf ", " | ||
| 31 | shift; | ||
| 32 | done | ||
| 33 | } | ||
| 34 | |||
| 35 | #gen_proto_order_variant(meta, pfx, name, sfx, order, atomic, int, arg...) | ||
| 36 | gen_proto_order_variant() | ||
| 37 | { | ||
| 38 | local meta="$1"; shift | ||
| 39 | local name="$1$2$3$4"; shift; shift; shift; shift | ||
| 40 | local atomic="$1"; shift | ||
| 41 | local int="$1"; shift | ||
| 42 | |||
| 43 | local ret="$(gen_ret_type "${meta}" "long")" | ||
| 44 | local params="$(gen_params "long" "atomic_long" "$@")" | ||
| 45 | local argscast="$(gen_args_cast "${int}" "${atomic}" "$@")" | ||
| 46 | local retstmt="$(gen_ret_stmt "${meta}")" | ||
| 47 | |||
| 48 | cat <<EOF | ||
| 49 | static inline ${ret} | ||
| 50 | atomic_long_${name}(${params}) | ||
| 51 | { | ||
| 52 | ${retstmt}${atomic}_${name}(${argscast}); | ||
| 53 | } | ||
| 54 | |||
| 55 | EOF | ||
| 56 | } | ||
| 57 | |||
| 58 | cat << EOF | ||
| 59 | // SPDX-License-Identifier: GPL-2.0 | ||
| 60 | |||
| 61 | // Generated by $0 | ||
| 62 | // DO NOT MODIFY THIS FILE DIRECTLY | ||
| 63 | |||
| 64 | #ifndef _ASM_GENERIC_ATOMIC_LONG_H | ||
| 65 | #define _ASM_GENERIC_ATOMIC_LONG_H | ||
| 66 | |||
| 67 | #include <asm/types.h> | ||
| 68 | |||
| 69 | #ifdef CONFIG_64BIT | ||
| 70 | typedef atomic64_t atomic_long_t; | ||
| 71 | #define ATOMIC_LONG_INIT(i) ATOMIC64_INIT(i) | ||
| 72 | #define atomic_long_cond_read_acquire atomic64_cond_read_acquire | ||
| 73 | #define atomic_long_cond_read_relaxed atomic64_cond_read_relaxed | ||
| 74 | #else | ||
| 75 | typedef atomic_t atomic_long_t; | ||
| 76 | #define ATOMIC_LONG_INIT(i) ATOMIC_INIT(i) | ||
| 77 | #define atomic_long_cond_read_acquire atomic_cond_read_acquire | ||
| 78 | #define atomic_long_cond_read_relaxed atomic_cond_read_relaxed | ||
| 79 | #endif | ||
| 80 | |||
| 81 | #ifdef CONFIG_64BIT | ||
| 82 | |||
| 83 | EOF | ||
| 84 | |||
| 85 | grep '^[a-z]' "$1" | while read name meta args; do | ||
| 86 | gen_proto "${meta}" "${name}" "atomic64" "s64" ${args} | ||
| 87 | done | ||
| 88 | |||
| 89 | cat <<EOF | ||
| 90 | #else /* CONFIG_64BIT */ | ||
| 91 | |||
| 92 | EOF | ||
| 93 | |||
| 94 | grep '^[a-z]' "$1" | while read name meta args; do | ||
| 95 | gen_proto "${meta}" "${name}" "atomic" "int" ${args} | ||
| 96 | done | ||
| 97 | |||
| 98 | cat <<EOF | ||
| 99 | #endif /* CONFIG_64BIT */ | ||
| 100 | #endif /* _ASM_GENERIC_ATOMIC_LONG_H */ | ||
| 101 | EOF | ||
diff --git a/scripts/atomic/gen-atomics.sh b/scripts/atomic/gen-atomics.sh new file mode 100644 index 000000000000..27400b0cd732 --- /dev/null +++ b/scripts/atomic/gen-atomics.sh | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # SPDX-License-Identifier: GPL-2.0 | ||
| 3 | # | ||
| 4 | # Generate atomic headers | ||
| 5 | |||
| 6 | ATOMICDIR=$(dirname $0) | ||
| 7 | ATOMICTBL=${ATOMICDIR}/atomics.tbl | ||
| 8 | LINUXDIR=${ATOMICDIR}/../.. | ||
| 9 | |||
| 10 | cat <<EOF | | ||
| 11 | gen-atomic-instrumented.sh asm-generic/atomic-instrumented.h | ||
| 12 | gen-atomic-long.sh asm-generic/atomic-long.h | ||
| 13 | gen-atomic-fallback.sh linux/atomic-fallback.h | ||
| 14 | EOF | ||
| 15 | while read script header; do | ||
| 16 | ${ATOMICDIR}/${script} ${ATOMICTBL} > ${LINUXDIR}/include/${header} | ||
| 17 | HASH="$(sha1sum ${LINUXDIR}/include/${header})" | ||
| 18 | HASH="${HASH%% *}" | ||
| 19 | printf "// %s\n" "${HASH}" >> ${LINUXDIR}/include/${header} | ||
| 20 | done | ||
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index b737ca9d7204..5b756278df13 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl | |||
| @@ -61,7 +61,7 @@ my $codespellfile = "/usr/share/codespell/dictionary.txt"; | |||
| 61 | my $conststructsfile = "$D/const_structs.checkpatch"; | 61 | my $conststructsfile = "$D/const_structs.checkpatch"; |
| 62 | my $typedefsfile = ""; | 62 | my $typedefsfile = ""; |
| 63 | my $color = "auto"; | 63 | my $color = "auto"; |
| 64 | my $allow_c99_comments = 1; | 64 | my $allow_c99_comments = 1; # Can be overridden by --ignore C99_COMMENT_TOLERANCE |
| 65 | 65 | ||
| 66 | sub help { | 66 | sub help { |
| 67 | my ($exitcode) = @_; | 67 | my ($exitcode) = @_; |
| @@ -466,6 +466,16 @@ our $logFunctions = qr{(?x: | |||
| 466 | seq_vprintf|seq_printf|seq_puts | 466 | seq_vprintf|seq_printf|seq_puts |
| 467 | )}; | 467 | )}; |
| 468 | 468 | ||
| 469 | our $allocFunctions = qr{(?x: | ||
| 470 | (?:(?:devm_)? | ||
| 471 | (?:kv|k|v)[czm]alloc(?:_node|_array)? | | ||
| 472 | kstrdup(?:_const)? | | ||
| 473 | kmemdup(?:_nul)?) | | ||
| 474 | (?:\w+)?alloc_skb(?:ip_align)? | | ||
| 475 | # dev_alloc_skb/netdev_alloc_skb, et al | ||
| 476 | dma_alloc_coherent | ||
| 477 | )}; | ||
| 478 | |||
| 469 | our $signature_tags = qr{(?xi: | 479 | our $signature_tags = qr{(?xi: |
| 470 | Signed-off-by:| | 480 | Signed-off-by:| |
| 471 | Co-developed-by:| | 481 | Co-developed-by:| |
| @@ -1011,6 +1021,7 @@ if ($git) { | |||
| 1011 | } | 1021 | } |
| 1012 | 1022 | ||
| 1013 | my $vname; | 1023 | my $vname; |
| 1024 | $allow_c99_comments = !defined $ignore_type{"C99_COMMENT_TOLERANCE"}; | ||
| 1014 | for my $filename (@ARGV) { | 1025 | for my $filename (@ARGV) { |
| 1015 | my $FILE; | 1026 | my $FILE; |
| 1016 | if ($git) { | 1027 | if ($git) { |
| @@ -3037,6 +3048,14 @@ sub process { | |||
| 3037 | $comment = '..'; | 3048 | $comment = '..'; |
| 3038 | } | 3049 | } |
| 3039 | 3050 | ||
| 3051 | # check SPDX comment style for .[chsS] files | ||
| 3052 | if ($realfile =~ /\.[chsS]$/ && | ||
| 3053 | $rawline =~ /SPDX-License-Identifier:/ && | ||
| 3054 | $rawline !~ /^\+\s*\Q$comment\E\s*/) { | ||
| 3055 | WARN("SPDX_LICENSE_TAG", | ||
| 3056 | "Improper SPDX comment style for '$realfile', please use '$comment' instead\n" . $herecurr); | ||
| 3057 | } | ||
| 3058 | |||
| 3040 | if ($comment !~ /^$/ && | 3059 | if ($comment !~ /^$/ && |
| 3041 | $rawline !~ /^\+\Q$comment\E SPDX-License-Identifier: /) { | 3060 | $rawline !~ /^\+\Q$comment\E SPDX-License-Identifier: /) { |
| 3042 | WARN("SPDX_LICENSE_TAG", | 3061 | WARN("SPDX_LICENSE_TAG", |
| @@ -3054,6 +3073,14 @@ sub process { | |||
| 3054 | # check we are in a valid source file if not then ignore this hunk | 3073 | # check we are in a valid source file if not then ignore this hunk |
| 3055 | next if ($realfile !~ /\.(h|c|s|S|sh|dtsi|dts)$/); | 3074 | next if ($realfile !~ /\.(h|c|s|S|sh|dtsi|dts)$/); |
| 3056 | 3075 | ||
| 3076 | # check for using SPDX-License-Identifier on the wrong line number | ||
| 3077 | if ($realline != $checklicenseline && | ||
| 3078 | $rawline =~ /\bSPDX-License-Identifier:/ && | ||
| 3079 | substr($line, @-, @+ - @-) eq "$;" x (@+ - @-)) { | ||
| 3080 | WARN("SPDX_LICENSE_TAG", | ||
| 3081 | "Misplaced SPDX-License-Identifier tag - use line $checklicenseline instead\n" . $herecurr); | ||
| 3082 | } | ||
| 3083 | |||
| 3057 | # line length limit (with some exclusions) | 3084 | # line length limit (with some exclusions) |
| 3058 | # | 3085 | # |
| 3059 | # There are a few types of lines that may extend beyond $max_line_length: | 3086 | # There are a few types of lines that may extend beyond $max_line_length: |
| @@ -5545,7 +5572,8 @@ sub process { | |||
| 5545 | my ($s, $c) = ctx_statement_block($linenr - 3, $realcnt, 0); | 5572 | my ($s, $c) = ctx_statement_block($linenr - 3, $realcnt, 0); |
| 5546 | # print("line: <$line>\nprevline: <$prevline>\ns: <$s>\nc: <$c>\n\n\n"); | 5573 | # print("line: <$line>\nprevline: <$prevline>\ns: <$s>\nc: <$c>\n\n\n"); |
| 5547 | 5574 | ||
| 5548 | if ($s =~ /(?:^|\n)[ \+]\s*(?:$Type\s*)?\Q$testval\E\s*=\s*(?:\([^\)]*\)\s*)?\s*(?:devm_)?(?:[kv][czm]alloc(?:_node|_array)?\b|kstrdup|kmemdup|(?:dev_)?alloc_skb)/) { | 5575 | if ($s =~ /(?:^|\n)[ \+]\s*(?:$Type\s*)?\Q$testval\E\s*=\s*(?:\([^\)]*\)\s*)?\s*$allocFunctions\s*\(/ && |
| 5576 | $s !~ /\b__GFP_NOWARN\b/ ) { | ||
| 5549 | WARN("OOM_MESSAGE", | 5577 | WARN("OOM_MESSAGE", |
| 5550 | "Possible unnecessary 'out of memory' message\n" . $hereprev); | 5578 | "Possible unnecessary 'out of memory' message\n" . $hereprev); |
| 5551 | } | 5579 | } |
| @@ -6196,8 +6224,8 @@ sub process { | |||
| 6196 | } | 6224 | } |
| 6197 | } | 6225 | } |
| 6198 | 6226 | ||
| 6199 | # check for pointless casting of kmalloc return | 6227 | # check for pointless casting of alloc functions |
| 6200 | if ($line =~ /\*\s*\)\s*[kv][czm]alloc(_node){0,1}\b/) { | 6228 | if ($line =~ /\*\s*\)\s*$allocFunctions\b/) { |
| 6201 | WARN("UNNECESSARY_CASTS", | 6229 | WARN("UNNECESSARY_CASTS", |
| 6202 | "unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr); | 6230 | "unnecessary cast may hide bugs, see http://c-faq.com/malloc/mallocnocast.html\n" . $herecurr); |
| 6203 | } | 6231 | } |
| @@ -6205,7 +6233,7 @@ sub process { | |||
| 6205 | # alloc style | 6233 | # alloc style |
| 6206 | # p = alloc(sizeof(struct foo), ...) should be p = alloc(sizeof(*p), ...) | 6234 | # p = alloc(sizeof(struct foo), ...) should be p = alloc(sizeof(*p), ...) |
| 6207 | if ($perl_version_ok && | 6235 | if ($perl_version_ok && |
| 6208 | $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*([kv][mz]alloc(?:_node)?)\s*\(\s*(sizeof\s*\(\s*struct\s+$Lval\s*\))/) { | 6236 | $line =~ /\b($Lval)\s*\=\s*(?:$balanced_parens)?\s*((?:kv|k|v)[mz]alloc(?:_node)?)\s*\(\s*(sizeof\s*\(\s*struct\s+$Lval\s*\))/) { |
| 6209 | CHK("ALLOC_SIZEOF_STRUCT", | 6237 | CHK("ALLOC_SIZEOF_STRUCT", |
| 6210 | "Prefer $3(sizeof(*$1)...) over $3($4...)\n" . $herecurr); | 6238 | "Prefer $3(sizeof(*$1)...) over $3($4...)\n" . $herecurr); |
| 6211 | } | 6239 | } |
| @@ -6368,19 +6396,6 @@ sub process { | |||
| 6368 | } | 6396 | } |
| 6369 | } | 6397 | } |
| 6370 | 6398 | ||
| 6371 | # check for bool bitfields | ||
| 6372 | if ($sline =~ /^.\s+bool\s*$Ident\s*:\s*\d+\s*;/) { | ||
| 6373 | WARN("BOOL_BITFIELD", | ||
| 6374 | "Avoid using bool as bitfield. Prefer bool bitfields as unsigned int or u<8|16|32>\n" . $herecurr); | ||
| 6375 | } | ||
| 6376 | |||
| 6377 | # check for bool use in .h files | ||
| 6378 | if ($realfile =~ /\.h$/ && | ||
| 6379 | $sline =~ /^.\s+bool\s*$Ident\s*(?::\s*d+\s*)?;/) { | ||
| 6380 | CHK("BOOL_MEMBER", | ||
| 6381 | "Avoid using bool structure members because of possible alignment issues - see: https://lkml.org/lkml/2017/11/21/384\n" . $herecurr); | ||
| 6382 | } | ||
| 6383 | |||
| 6384 | # check for semaphores initialized locked | 6399 | # check for semaphores initialized locked |
| 6385 | if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) { | 6400 | if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) { |
| 6386 | WARN("CONSIDER_COMPLETION", | 6401 | WARN("CONSIDER_COMPLETION", |
diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh index cf931003395f..a18b47695f55 100755 --- a/scripts/checksyscalls.sh +++ b/scripts/checksyscalls.sh | |||
| @@ -30,12 +30,14 @@ cat << EOF | |||
| 30 | #define __IGNORE_readlink /* readlinkat */ | 30 | #define __IGNORE_readlink /* readlinkat */ |
| 31 | #define __IGNORE_symlink /* symlinkat */ | 31 | #define __IGNORE_symlink /* symlinkat */ |
| 32 | #define __IGNORE_utimes /* futimesat */ | 32 | #define __IGNORE_utimes /* futimesat */ |
| 33 | #if BITS_PER_LONG == 64 | ||
| 34 | #define __IGNORE_stat /* fstatat */ | 33 | #define __IGNORE_stat /* fstatat */ |
| 35 | #define __IGNORE_lstat /* fstatat */ | 34 | #define __IGNORE_lstat /* fstatat */ |
| 36 | #else | ||
| 37 | #define __IGNORE_stat64 /* fstatat64 */ | 35 | #define __IGNORE_stat64 /* fstatat64 */ |
| 38 | #define __IGNORE_lstat64 /* fstatat64 */ | 36 | #define __IGNORE_lstat64 /* fstatat64 */ |
| 37 | |||
| 38 | #ifndef __ARCH_WANT_SET_GET_RLIMIT | ||
| 39 | #define __IGNORE_getrlimit /* getrlimit */ | ||
| 40 | #define __IGNORE_setrlimit /* setrlimit */ | ||
| 39 | #endif | 41 | #endif |
| 40 | 42 | ||
| 41 | /* Missing flags argument */ | 43 | /* Missing flags argument */ |
| @@ -84,6 +86,26 @@ cat << EOF | |||
| 84 | #define __IGNORE_statfs64 | 86 | #define __IGNORE_statfs64 |
| 85 | #define __IGNORE_llseek | 87 | #define __IGNORE_llseek |
| 86 | #define __IGNORE_mmap2 | 88 | #define __IGNORE_mmap2 |
| 89 | #define __IGNORE_clock_gettime64 | ||
| 90 | #define __IGNORE_clock_settime64 | ||
| 91 | #define __IGNORE_clock_adjtime64 | ||
| 92 | #define __IGNORE_clock_getres_time64 | ||
| 93 | #define __IGNORE_clock_nanosleep_time64 | ||
| 94 | #define __IGNORE_timer_gettime64 | ||
| 95 | #define __IGNORE_timer_settime64 | ||
| 96 | #define __IGNORE_timerfd_gettime64 | ||
| 97 | #define __IGNORE_timerfd_settime64 | ||
| 98 | #define __IGNORE_utimensat_time64 | ||
| 99 | #define __IGNORE_pselect6_time64 | ||
| 100 | #define __IGNORE_ppoll_time64 | ||
| 101 | #define __IGNORE_io_pgetevents_time64 | ||
| 102 | #define __IGNORE_recvmmsg_time64 | ||
| 103 | #define __IGNORE_mq_timedsend_time64 | ||
| 104 | #define __IGNORE_mq_timedreceive_time64 | ||
| 105 | #define __IGNORE_semtimedop_time64 | ||
| 106 | #define __IGNORE_rt_sigtimedwait_time64 | ||
| 107 | #define __IGNORE_futex_time64 | ||
| 108 | #define __IGNORE_sched_rr_get_interval_time64 | ||
| 87 | #else | 109 | #else |
| 88 | #define __IGNORE_sendfile | 110 | #define __IGNORE_sendfile |
| 89 | #define __IGNORE_ftruncate | 111 | #define __IGNORE_ftruncate |
| @@ -98,6 +120,33 @@ cat << EOF | |||
| 98 | #define __IGNORE_statfs | 120 | #define __IGNORE_statfs |
| 99 | #define __IGNORE_lseek | 121 | #define __IGNORE_lseek |
| 100 | #define __IGNORE_mmap | 122 | #define __IGNORE_mmap |
| 123 | #define __IGNORE_clock_gettime | ||
| 124 | #define __IGNORE_clock_settime | ||
| 125 | #define __IGNORE_clock_adjtime | ||
| 126 | #define __IGNORE_clock_getres | ||
| 127 | #define __IGNORE_clock_nanosleep | ||
| 128 | #define __IGNORE_timer_gettime | ||
| 129 | #define __IGNORE_timer_settime | ||
| 130 | #define __IGNORE_timerfd_gettime | ||
| 131 | #define __IGNORE_timerfd_settime | ||
| 132 | #define __IGNORE_utimensat | ||
| 133 | #define __IGNORE_pselect6 | ||
| 134 | #define __IGNORE_ppoll | ||
| 135 | #define __IGNORE_io_pgetevents | ||
| 136 | #define __IGNORE_recvmmsg | ||
| 137 | #define __IGNORE_mq_timedsend | ||
| 138 | #define __IGNORE_mq_timedreceive | ||
| 139 | #define __IGNORE_semtimedop | ||
| 140 | #define __IGNORE_rt_sigtimedwait | ||
| 141 | #define __IGNORE_futex | ||
| 142 | #define __IGNORE_sched_rr_get_interval | ||
| 143 | #define __IGNORE_gettimeofday | ||
| 144 | #define __IGNORE_settimeofday | ||
| 145 | #define __IGNORE_wait4 | ||
| 146 | #define __IGNORE_adjtimex | ||
| 147 | #define __IGNORE_nanosleep | ||
| 148 | #define __IGNORE_io_getevents | ||
| 149 | #define __IGNORE_recvmmsg | ||
| 101 | #endif | 150 | #endif |
| 102 | 151 | ||
| 103 | /* i386-specific or historical system calls */ | 152 | /* i386-specific or historical system calls */ |
diff --git a/scripts/decode_stacktrace.sh b/scripts/decode_stacktrace.sh index 98a7d63a723e..bcdd45df3f51 100755 --- a/scripts/decode_stacktrace.sh +++ b/scripts/decode_stacktrace.sh | |||
| @@ -37,6 +37,13 @@ parse_symbol() { | |||
| 37 | symbol=${symbol#\(} | 37 | symbol=${symbol#\(} |
| 38 | symbol=${symbol%\)} | 38 | symbol=${symbol%\)} |
| 39 | 39 | ||
| 40 | # Strip segment | ||
| 41 | local segment | ||
| 42 | if [[ $symbol == *:* ]] ; then | ||
| 43 | segment=${symbol%%:*}: | ||
| 44 | symbol=${symbol#*:} | ||
| 45 | fi | ||
| 46 | |||
| 40 | # Strip the symbol name so that we could look it up | 47 | # Strip the symbol name so that we could look it up |
| 41 | local name=${symbol%+*} | 48 | local name=${symbol%+*} |
| 42 | 49 | ||
| @@ -84,7 +91,7 @@ parse_symbol() { | |||
| 84 | code=${code//$'\n'/' '} | 91 | code=${code//$'\n'/' '} |
| 85 | 92 | ||
| 86 | # Replace old address with pretty line numbers | 93 | # Replace old address with pretty line numbers |
| 87 | symbol="$name ($code)" | 94 | symbol="$segment$name ($code)" |
| 88 | } | 95 | } |
| 89 | 96 | ||
| 90 | decode_code() { | 97 | decode_code() { |
diff --git a/scripts/dtc/dtx_diff b/scripts/dtc/dtx_diff index 8c4fbad2055e..0d8572008729 100755 --- a/scripts/dtc/dtx_diff +++ b/scripts/dtc/dtx_diff | |||
| @@ -21,6 +21,7 @@ Usage: | |||
| 21 | diff DTx_1 and DTx_2 | 21 | diff DTx_1 and DTx_2 |
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | --annotate synonym for -T | ||
| 24 | -f print full dts in diff (--unified=99999) | 25 | -f print full dts in diff (--unified=99999) |
| 25 | -h synonym for --help | 26 | -h synonym for --help |
| 26 | -help synonym for --help | 27 | -help synonym for --help |
| @@ -28,6 +29,7 @@ Usage: | |||
| 28 | -s SRCTREE linux kernel source tree is at path SRCTREE | 29 | -s SRCTREE linux kernel source tree is at path SRCTREE |
| 29 | (default is current directory) | 30 | (default is current directory) |
| 30 | -S linux kernel source tree is at root of current git repo | 31 | -S linux kernel source tree is at root of current git repo |
| 32 | -T Annotate output .dts with input source file and line (-T -T for more details) | ||
| 31 | -u unsorted, do not sort DTx | 33 | -u unsorted, do not sort DTx |
| 32 | 34 | ||
| 33 | 35 | ||
| @@ -174,6 +176,7 @@ compile_to_dts() { | |||
| 174 | 176 | ||
| 175 | # ----- start of script | 177 | # ----- start of script |
| 176 | 178 | ||
| 179 | annotate="" | ||
| 177 | cmd_diff=0 | 180 | cmd_diff=0 |
| 178 | diff_flags="-u" | 181 | diff_flags="-u" |
| 179 | dtx_file_1="" | 182 | dtx_file_1="" |
| @@ -208,6 +211,14 @@ while [ $# -gt 0 ] ; do | |||
| 208 | shift | 211 | shift |
| 209 | ;; | 212 | ;; |
| 210 | 213 | ||
| 214 | -T | --annotate ) | ||
| 215 | if [ "${annotate}" = "" ] ; then | ||
| 216 | annotate="-T" | ||
| 217 | elif [ "${annotate}" = "-T" ] ; then | ||
| 218 | annotate="-T -T" | ||
| 219 | fi | ||
| 220 | shift | ||
| 221 | ;; | ||
| 211 | -u ) | 222 | -u ) |
| 212 | dtc_sort="" | 223 | dtc_sort="" |
| 213 | shift | 224 | shift |
| @@ -327,7 +338,7 @@ cpp_flags="\ | |||
| 327 | DTC="\ | 338 | DTC="\ |
| 328 | ${DTC} \ | 339 | ${DTC} \ |
| 329 | -i ${srctree}/scripts/dtc/include-prefixes \ | 340 | -i ${srctree}/scripts/dtc/include-prefixes \ |
| 330 | -O dts -qq -f ${dtc_sort} -o -" | 341 | -O dts -qq -f ${dtc_sort} ${annotate} -o -" |
| 331 | 342 | ||
| 332 | 343 | ||
| 333 | # ----- do the diff or decompile | 344 | # ----- do the diff or decompile |
diff --git a/scripts/gcc-plugins/Kconfig b/scripts/gcc-plugins/Kconfig index d45f7f36b859..74271dba4f94 100644 --- a/scripts/gcc-plugins/Kconfig +++ b/scripts/gcc-plugins/Kconfig | |||
| @@ -67,27 +67,59 @@ config GCC_PLUGIN_LATENT_ENTROPY | |||
| 67 | * https://pax.grsecurity.net/ | 67 | * https://pax.grsecurity.net/ |
| 68 | 68 | ||
| 69 | config GCC_PLUGIN_STRUCTLEAK | 69 | config GCC_PLUGIN_STRUCTLEAK |
| 70 | bool "Force initialization of variables containing userspace addresses" | 70 | bool "Zero initialize stack variables" |
| 71 | # Currently STRUCTLEAK inserts initialization out of live scope of | ||
| 72 | # variables from KASAN point of view. This leads to KASAN false | ||
| 73 | # positive reports. Prohibit this combination for now. | ||
| 74 | depends on !KASAN_EXTRA | ||
| 75 | help | 71 | help |
| 76 | This plugin zero-initializes any structures containing a | 72 | While the kernel is built with warnings enabled for any missed |
| 77 | __user attribute. This can prevent some classes of information | 73 | stack variable initializations, this warning is silenced for |
| 78 | exposures. | 74 | anything passed by reference to another function, under the |
| 79 | 75 | occasionally misguided assumption that the function will do | |
| 80 | This plugin was ported from grsecurity/PaX. More information at: | 76 | the initialization. As this regularly leads to exploitable |
| 77 | flaws, this plugin is available to identify and zero-initialize | ||
| 78 | such variables, depending on the chosen level of coverage. | ||
| 79 | |||
| 80 | This plugin was originally ported from grsecurity/PaX. More | ||
| 81 | information at: | ||
| 81 | * https://grsecurity.net/ | 82 | * https://grsecurity.net/ |
| 82 | * https://pax.grsecurity.net/ | 83 | * https://pax.grsecurity.net/ |
| 83 | 84 | ||
| 84 | config GCC_PLUGIN_STRUCTLEAK_BYREF_ALL | 85 | choice |
| 85 | bool "Force initialize all struct type variables passed by reference" | 86 | prompt "Coverage" |
| 86 | depends on GCC_PLUGIN_STRUCTLEAK | 87 | depends on GCC_PLUGIN_STRUCTLEAK |
| 87 | depends on !COMPILE_TEST | 88 | default GCC_PLUGIN_STRUCTLEAK_BYREF_ALL |
| 88 | help | 89 | help |
| 89 | Zero initialize any struct type local variable that may be passed by | 90 | This chooses the level of coverage over classes of potentially |
| 90 | reference without having been initialized. | 91 | uninitialized variables. The selected class will be |
| 92 | zero-initialized before use. | ||
| 93 | |||
| 94 | config GCC_PLUGIN_STRUCTLEAK_USER | ||
| 95 | bool "structs marked for userspace" | ||
| 96 | help | ||
| 97 | Zero-initialize any structures on the stack containing | ||
| 98 | a __user attribute. This can prevent some classes of | ||
| 99 | uninitialized stack variable exploits and information | ||
| 100 | exposures, like CVE-2013-2141: | ||
| 101 | https://git.kernel.org/linus/b9e146d8eb3b9eca | ||
| 102 | |||
| 103 | config GCC_PLUGIN_STRUCTLEAK_BYREF | ||
| 104 | bool "structs passed by reference" | ||
| 105 | help | ||
| 106 | Zero-initialize any structures on the stack that may | ||
| 107 | be passed by reference and had not already been | ||
| 108 | explicitly initialized. This can prevent most classes | ||
| 109 | of uninitialized stack variable exploits and information | ||
| 110 | exposures, like CVE-2017-1000410: | ||
| 111 | https://git.kernel.org/linus/06e7e776ca4d3654 | ||
| 112 | |||
| 113 | config GCC_PLUGIN_STRUCTLEAK_BYREF_ALL | ||
| 114 | bool "anything passed by reference" | ||
| 115 | help | ||
| 116 | Zero-initialize any stack variables that may be passed | ||
| 117 | by reference and had not already been explicitly | ||
| 118 | initialized. This is intended to eliminate all classes | ||
| 119 | of uninitialized stack variable exploits and information | ||
| 120 | exposures. | ||
| 121 | |||
| 122 | endchoice | ||
| 91 | 123 | ||
| 92 | config GCC_PLUGIN_STRUCTLEAK_VERBOSE | 124 | config GCC_PLUGIN_STRUCTLEAK_VERBOSE |
| 93 | bool "Report forcefully initialized variables" | 125 | bool "Report forcefully initialized variables" |
diff --git a/scripts/gcc-plugins/structleak_plugin.c b/scripts/gcc-plugins/structleak_plugin.c index 10292f791e99..e89be8f5c859 100644 --- a/scripts/gcc-plugins/structleak_plugin.c +++ b/scripts/gcc-plugins/structleak_plugin.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | * Options: | 16 | * Options: |
| 17 | * -fplugin-arg-structleak_plugin-disable | 17 | * -fplugin-arg-structleak_plugin-disable |
| 18 | * -fplugin-arg-structleak_plugin-verbose | 18 | * -fplugin-arg-structleak_plugin-verbose |
| 19 | * -fplugin-arg-structleak_plugin-byref | ||
| 19 | * -fplugin-arg-structleak_plugin-byref-all | 20 | * -fplugin-arg-structleak_plugin-byref-all |
| 20 | * | 21 | * |
| 21 | * Usage: | 22 | * Usage: |
| @@ -26,7 +27,6 @@ | |||
| 26 | * $ gcc -fplugin=./structleak_plugin.so test.c -O2 | 27 | * $ gcc -fplugin=./structleak_plugin.so test.c -O2 |
| 27 | * | 28 | * |
| 28 | * TODO: eliminate redundant initializers | 29 | * TODO: eliminate redundant initializers |
| 29 | * increase type coverage | ||
| 30 | */ | 30 | */ |
| 31 | 31 | ||
| 32 | #include "gcc-common.h" | 32 | #include "gcc-common.h" |
| @@ -37,13 +37,18 @@ | |||
| 37 | __visible int plugin_is_GPL_compatible; | 37 | __visible int plugin_is_GPL_compatible; |
| 38 | 38 | ||
| 39 | static struct plugin_info structleak_plugin_info = { | 39 | static struct plugin_info structleak_plugin_info = { |
| 40 | .version = "201607271510vanilla", | 40 | .version = "20190125vanilla", |
| 41 | .help = "disable\tdo not activate plugin\n" | 41 | .help = "disable\tdo not activate plugin\n" |
| 42 | "verbose\tprint all initialized variables\n", | 42 | "byref\tinit structs passed by reference\n" |
| 43 | "byref-all\tinit anything passed by reference\n" | ||
| 44 | "verbose\tprint all initialized variables\n", | ||
| 43 | }; | 45 | }; |
| 44 | 46 | ||
| 47 | #define BYREF_STRUCT 1 | ||
| 48 | #define BYREF_ALL 2 | ||
| 49 | |||
| 45 | static bool verbose; | 50 | static bool verbose; |
| 46 | static bool byref_all; | 51 | static int byref; |
| 47 | 52 | ||
| 48 | static tree handle_user_attribute(tree *node, tree name, tree args, int flags, bool *no_add_attrs) | 53 | static tree handle_user_attribute(tree *node, tree name, tree args, int flags, bool *no_add_attrs) |
| 49 | { | 54 | { |
| @@ -118,6 +123,7 @@ static void initialize(tree var) | |||
| 118 | gimple_stmt_iterator gsi; | 123 | gimple_stmt_iterator gsi; |
| 119 | tree initializer; | 124 | tree initializer; |
| 120 | gimple init_stmt; | 125 | gimple init_stmt; |
| 126 | tree type; | ||
| 121 | 127 | ||
| 122 | /* this is the original entry bb before the forced split */ | 128 | /* this is the original entry bb before the forced split */ |
| 123 | bb = single_succ(ENTRY_BLOCK_PTR_FOR_FN(cfun)); | 129 | bb = single_succ(ENTRY_BLOCK_PTR_FOR_FN(cfun)); |
| @@ -148,11 +154,15 @@ static void initialize(tree var) | |||
| 148 | if (verbose) | 154 | if (verbose) |
| 149 | inform(DECL_SOURCE_LOCATION(var), | 155 | inform(DECL_SOURCE_LOCATION(var), |
| 150 | "%s variable will be forcibly initialized", | 156 | "%s variable will be forcibly initialized", |
| 151 | (byref_all && TREE_ADDRESSABLE(var)) ? "byref" | 157 | (byref && TREE_ADDRESSABLE(var)) ? "byref" |
| 152 | : "userspace"); | 158 | : "userspace"); |
| 153 | 159 | ||
| 154 | /* build the initializer expression */ | 160 | /* build the initializer expression */ |
| 155 | initializer = build_constructor(TREE_TYPE(var), NULL); | 161 | type = TREE_TYPE(var); |
| 162 | if (AGGREGATE_TYPE_P(type)) | ||
| 163 | initializer = build_constructor(type, NULL); | ||
| 164 | else | ||
| 165 | initializer = fold_convert(type, integer_zero_node); | ||
| 156 | 166 | ||
| 157 | /* build the initializer stmt */ | 167 | /* build the initializer stmt */ |
| 158 | init_stmt = gimple_build_assign(var, initializer); | 168 | init_stmt = gimple_build_assign(var, initializer); |
| @@ -184,13 +194,13 @@ static unsigned int structleak_execute(void) | |||
| 184 | if (!auto_var_in_fn_p(var, current_function_decl)) | 194 | if (!auto_var_in_fn_p(var, current_function_decl)) |
| 185 | continue; | 195 | continue; |
| 186 | 196 | ||
| 187 | /* only care about structure types */ | 197 | /* only care about structure types unless byref-all */ |
| 188 | if (TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE) | 198 | if (byref != BYREF_ALL && TREE_CODE(type) != RECORD_TYPE && TREE_CODE(type) != UNION_TYPE) |
| 189 | continue; | 199 | continue; |
| 190 | 200 | ||
| 191 | /* if the type is of interest, examine the variable */ | 201 | /* if the type is of interest, examine the variable */ |
| 192 | if (TYPE_USERSPACE(type) || | 202 | if (TYPE_USERSPACE(type) || |
| 193 | (byref_all && TREE_ADDRESSABLE(var))) | 203 | (byref && TREE_ADDRESSABLE(var))) |
| 194 | initialize(var); | 204 | initialize(var); |
| 195 | } | 205 | } |
| 196 | 206 | ||
| @@ -232,8 +242,12 @@ __visible int plugin_init(struct plugin_name_args *plugin_info, struct plugin_gc | |||
| 232 | verbose = true; | 242 | verbose = true; |
| 233 | continue; | 243 | continue; |
| 234 | } | 244 | } |
| 245 | if (!strcmp(argv[i].key, "byref")) { | ||
| 246 | byref = BYREF_STRUCT; | ||
| 247 | continue; | ||
| 248 | } | ||
| 235 | if (!strcmp(argv[i].key, "byref-all")) { | 249 | if (!strcmp(argv[i].key, "byref-all")) { |
| 236 | byref_all = true; | 250 | byref = BYREF_ALL; |
| 237 | continue; | 251 | continue; |
| 238 | } | 252 | } |
| 239 | error(G_("unknown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key); | 253 | error(G_("unknown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key); |
diff --git a/scripts/gdb/linux/constants.py.in b/scripts/gdb/linux/constants.py.in index 7aad82406422..d3319a80788a 100644 --- a/scripts/gdb/linux/constants.py.in +++ b/scripts/gdb/linux/constants.py.in | |||
| @@ -37,12 +37,12 @@ | |||
| 37 | import gdb | 37 | import gdb |
| 38 | 38 | ||
| 39 | /* linux/fs.h */ | 39 | /* linux/fs.h */ |
| 40 | LX_VALUE(MS_RDONLY) | 40 | LX_VALUE(SB_RDONLY) |
| 41 | LX_VALUE(MS_SYNCHRONOUS) | 41 | LX_VALUE(SB_SYNCHRONOUS) |
| 42 | LX_VALUE(MS_MANDLOCK) | 42 | LX_VALUE(SB_MANDLOCK) |
| 43 | LX_VALUE(MS_DIRSYNC) | 43 | LX_VALUE(SB_DIRSYNC) |
| 44 | LX_VALUE(MS_NOATIME) | 44 | LX_VALUE(SB_NOATIME) |
| 45 | LX_VALUE(MS_NODIRATIME) | 45 | LX_VALUE(SB_NODIRATIME) |
| 46 | 46 | ||
| 47 | /* linux/mount.h */ | 47 | /* linux/mount.h */ |
| 48 | LX_VALUE(MNT_NOSUID) | 48 | LX_VALUE(MNT_NOSUID) |
diff --git a/scripts/gdb/linux/proc.py b/scripts/gdb/linux/proc.py index 0aebd7565b03..2f01a958eb22 100644 --- a/scripts/gdb/linux/proc.py +++ b/scripts/gdb/linux/proc.py | |||
| @@ -114,11 +114,11 @@ def info_opts(lst, opt): | |||
| 114 | return opts | 114 | return opts |
| 115 | 115 | ||
| 116 | 116 | ||
| 117 | FS_INFO = {constants.LX_MS_SYNCHRONOUS: ",sync", | 117 | FS_INFO = {constants.LX_SB_SYNCHRONOUS: ",sync", |
| 118 | constants.LX_MS_MANDLOCK: ",mand", | 118 | constants.LX_SB_MANDLOCK: ",mand", |
| 119 | constants.LX_MS_DIRSYNC: ",dirsync", | 119 | constants.LX_SB_DIRSYNC: ",dirsync", |
| 120 | constants.LX_MS_NOATIME: ",noatime", | 120 | constants.LX_SB_NOATIME: ",noatime", |
| 121 | constants.LX_MS_NODIRATIME: ",nodiratime"} | 121 | constants.LX_SB_NODIRATIME: ",nodiratime"} |
| 122 | 122 | ||
| 123 | MNT_INFO = {constants.LX_MNT_NOSUID: ",nosuid", | 123 | MNT_INFO = {constants.LX_MNT_NOSUID: ",nosuid", |
| 124 | constants.LX_MNT_NODEV: ",nodev", | 124 | constants.LX_MNT_NODEV: ",nodev", |
| @@ -184,7 +184,7 @@ values of that process namespace""" | |||
| 184 | fstype = superblock['s_type']['name'].string() | 184 | fstype = superblock['s_type']['name'].string() |
| 185 | s_flags = int(superblock['s_flags']) | 185 | s_flags = int(superblock['s_flags']) |
| 186 | m_flags = int(vfs['mnt']['mnt_flags']) | 186 | m_flags = int(vfs['mnt']['mnt_flags']) |
| 187 | rd = "ro" if (s_flags & constants.LX_MS_RDONLY) else "rw" | 187 | rd = "ro" if (s_flags & constants.LX_SB_RDONLY) else "rw" |
| 188 | 188 | ||
| 189 | gdb.write( | 189 | gdb.write( |
| 190 | "{} {} {} {}{}{} 0 0\n" | 190 | "{} {} {} {}{}{} 0 0\n" |
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 77cebad0474e..f75e7bda4889 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c | |||
| @@ -118,8 +118,8 @@ static int read_symbol(FILE *in, struct sym_entry *s) | |||
| 118 | fprintf(stderr, "Read error or end of file.\n"); | 118 | fprintf(stderr, "Read error or end of file.\n"); |
| 119 | return -1; | 119 | return -1; |
| 120 | } | 120 | } |
| 121 | if (strlen(sym) > KSYM_NAME_LEN) { | 121 | if (strlen(sym) >= KSYM_NAME_LEN) { |
| 122 | fprintf(stderr, "Symbol %s too long for kallsyms (%zu vs %d).\n" | 122 | fprintf(stderr, "Symbol %s too long for kallsyms (%zu >= %d).\n" |
| 123 | "Please increase KSYM_NAME_LEN both in kernel and kallsyms.c\n", | 123 | "Please increase KSYM_NAME_LEN both in kernel and kallsyms.c\n", |
| 124 | sym, strlen(sym), KSYM_NAME_LEN); | 124 | sym, strlen(sym), KSYM_NAME_LEN); |
| 125 | return -1; | 125 | return -1; |
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index c5333d251985..3350e498b4ce 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
| @@ -1474,7 +1474,7 @@ sub push_parameter($$$$) { | |||
| 1474 | if (!defined $parameterdescs{$param} && $param !~ /^#/) { | 1474 | if (!defined $parameterdescs{$param} && $param !~ /^#/) { |
| 1475 | $parameterdescs{$param} = $undescribed; | 1475 | $parameterdescs{$param} = $undescribed; |
| 1476 | 1476 | ||
| 1477 | if (show_warnings($type, $declaration_name)) { | 1477 | if (show_warnings($type, $declaration_name) && $param !~ /\./) { |
| 1478 | print STDERR | 1478 | print STDERR |
| 1479 | "${file}:$.: warning: Function parameter or member '$param' not described in '$declaration_name'\n"; | 1479 | "${file}:$.: warning: Function parameter or member '$param' not described in '$declaration_name'\n"; |
| 1480 | ++$warnings; | 1480 | ++$warnings; |
diff --git a/scripts/leaking_addresses.pl b/scripts/leaking_addresses.pl index 6a897788f5a7..ef9e5b2a1614 100755 --- a/scripts/leaking_addresses.pl +++ b/scripts/leaking_addresses.pl | |||
| @@ -97,7 +97,7 @@ Options: | |||
| 97 | --32-bit Scan 32-bit kernel. | 97 | --32-bit Scan 32-bit kernel. |
| 98 | --page-offset-32-bit=o Page offset (for 32-bit kernel 0xABCD1234). | 98 | --page-offset-32-bit=o Page offset (for 32-bit kernel 0xABCD1234). |
| 99 | -d, --debug Display debugging output. | 99 | -d, --debug Display debugging output. |
| 100 | -h, --help, --version Display this help and exit. | 100 | -h, --help Display this help and exit. |
| 101 | 101 | ||
| 102 | Scans the running kernel for potential leaking addresses. | 102 | Scans the running kernel for potential leaking addresses. |
| 103 | 103 | ||
| @@ -108,7 +108,6 @@ EOM | |||
| 108 | GetOptions( | 108 | GetOptions( |
| 109 | 'd|debug' => \$debug, | 109 | 'd|debug' => \$debug, |
| 110 | 'h|help' => \$help, | 110 | 'h|help' => \$help, |
| 111 | 'version' => \$help, | ||
| 112 | 'o|output-raw=s' => \$output_raw, | 111 | 'o|output-raw=s' => \$output_raw, |
| 113 | 'i|input-raw=s' => \$input_raw, | 112 | 'i|input-raw=s' => \$input_raw, |
| 114 | 'suppress-dmesg' => \$suppress_dmesg, | 113 | 'suppress-dmesg' => \$suppress_dmesg, |
| @@ -231,7 +230,7 @@ sub get_kernel_config_option | |||
| 231 | my $tmp_file = "/tmp/tmpkconf"; | 230 | my $tmp_file = "/tmp/tmpkconf"; |
| 232 | 231 | ||
| 233 | if (system("gunzip < /proc/config.gz > $tmp_file")) { | 232 | if (system("gunzip < /proc/config.gz > $tmp_file")) { |
| 234 | dprint "$0: system(gunzip < /proc/config.gz) failed\n"; | 233 | dprint("system(gunzip < /proc/config.gz) failed\n"); |
| 235 | return ""; | 234 | return ""; |
| 236 | } else { | 235 | } else { |
| 237 | @config_files = ($tmp_file); | 236 | @config_files = ($tmp_file); |
| @@ -243,7 +242,7 @@ sub get_kernel_config_option | |||
| 243 | } | 242 | } |
| 244 | 243 | ||
| 245 | foreach my $file (@config_files) { | 244 | foreach my $file (@config_files) { |
| 246 | dprint("parsing config file: %s\n", $file); | 245 | dprint("parsing config file: $file\n"); |
| 247 | $value = option_from_file($option, $file); | 246 | $value = option_from_file($option, $file); |
| 248 | if ($value ne "") { | 247 | if ($value ne "") { |
| 249 | last; | 248 | last; |
| @@ -502,7 +501,7 @@ sub walk | |||
| 502 | next; | 501 | next; |
| 503 | } | 502 | } |
| 504 | 503 | ||
| 505 | dprint "parsing: $path\n"; | 504 | dprint("parsing: $path\n"); |
| 506 | timed_parse_file($path); | 505 | timed_parse_file($path); |
| 507 | } | 506 | } |
| 508 | } | 507 | } |
diff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c index 293004499b4d..054405b90ba4 100644 --- a/scripts/mod/devicetable-offsets.c +++ b/scripts/mod/devicetable-offsets.c | |||
| @@ -225,5 +225,11 @@ int main(void) | |||
| 225 | DEVID_FIELD(typec_device_id, svid); | 225 | DEVID_FIELD(typec_device_id, svid); |
| 226 | DEVID_FIELD(typec_device_id, mode); | 226 | DEVID_FIELD(typec_device_id, mode); |
| 227 | 227 | ||
| 228 | DEVID(tee_client_device_id); | ||
| 229 | DEVID_FIELD(tee_client_device_id, uuid); | ||
| 230 | |||
| 231 | DEVID(wmi_device_id); | ||
| 232 | DEVID_FIELD(wmi_device_id, guid_string); | ||
| 233 | |||
| 228 | return 0; | 234 | return 0; |
| 229 | } | 235 | } |
diff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c index a37af7d71973..e17a29ae2e97 100644 --- a/scripts/mod/file2alias.c +++ b/scripts/mod/file2alias.c | |||
| @@ -37,6 +37,10 @@ typedef unsigned char __u8; | |||
| 37 | typedef struct { | 37 | typedef struct { |
| 38 | __u8 b[16]; | 38 | __u8 b[16]; |
| 39 | } uuid_le; | 39 | } uuid_le; |
| 40 | typedef struct { | ||
| 41 | __u8 b[16]; | ||
| 42 | } uuid_t; | ||
| 43 | #define UUID_STRING_LEN 36 | ||
| 40 | 44 | ||
| 41 | /* Big exception to the "don't include kernel headers into userspace, which | 45 | /* Big exception to the "don't include kernel headers into userspace, which |
| 42 | * even potentially has different endianness and word sizes, since | 46 | * even potentially has different endianness and word sizes, since |
| @@ -50,6 +54,9 @@ struct devtable { | |||
| 50 | int (*do_entry)(const char *filename, void *symval, char *alias); | 54 | int (*do_entry)(const char *filename, void *symval, char *alias); |
| 51 | }; | 55 | }; |
| 52 | 56 | ||
| 57 | /* Size of alias provided to do_entry functions */ | ||
| 58 | #define ALIAS_SIZE 500 | ||
| 59 | |||
| 53 | /* Define a variable f that holds the value of field f of struct devid | 60 | /* Define a variable f that holds the value of field f of struct devid |
| 54 | * based at address m. | 61 | * based at address m. |
| 55 | */ | 62 | */ |
| @@ -1287,6 +1294,42 @@ static int do_typec_entry(const char *filename, void *symval, char *alias) | |||
| 1287 | return 1; | 1294 | return 1; |
| 1288 | } | 1295 | } |
| 1289 | 1296 | ||
| 1297 | /* Looks like: tee:uuid */ | ||
| 1298 | static int do_tee_entry(const char *filename, void *symval, char *alias) | ||
| 1299 | { | ||
| 1300 | DEF_FIELD(symval, tee_client_device_id, uuid); | ||
| 1301 | |||
| 1302 | sprintf(alias, "tee:%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", | ||
| 1303 | uuid.b[0], uuid.b[1], uuid.b[2], uuid.b[3], uuid.b[4], | ||
| 1304 | uuid.b[5], uuid.b[6], uuid.b[7], uuid.b[8], uuid.b[9], | ||
| 1305 | uuid.b[10], uuid.b[11], uuid.b[12], uuid.b[13], uuid.b[14], | ||
| 1306 | uuid.b[15]); | ||
| 1307 | |||
| 1308 | add_wildcard(alias); | ||
| 1309 | return 1; | ||
| 1310 | } | ||
| 1311 | |||
| 1312 | /* Looks like: wmi:guid */ | ||
| 1313 | static int do_wmi_entry(const char *filename, void *symval, char *alias) | ||
| 1314 | { | ||
| 1315 | int len; | ||
| 1316 | DEF_FIELD_ADDR(symval, wmi_device_id, guid_string); | ||
| 1317 | |||
| 1318 | if (strlen(*guid_string) != UUID_STRING_LEN) { | ||
| 1319 | warn("Invalid WMI device id 'wmi:%s' in '%s'\n", | ||
| 1320 | *guid_string, filename); | ||
| 1321 | return 0; | ||
| 1322 | } | ||
| 1323 | |||
| 1324 | len = snprintf(alias, ALIAS_SIZE, WMI_MODULE_PREFIX "%s", *guid_string); | ||
| 1325 | if (len < 0 || len >= ALIAS_SIZE) { | ||
| 1326 | warn("Could not generate all MODULE_ALIAS's in '%s'\n", | ||
| 1327 | filename); | ||
| 1328 | return 0; | ||
| 1329 | } | ||
| 1330 | return 1; | ||
| 1331 | } | ||
| 1332 | |||
| 1290 | /* Does namelen bytes of name exactly match the symbol? */ | 1333 | /* Does namelen bytes of name exactly match the symbol? */ |
| 1291 | static bool sym_is(const char *name, unsigned namelen, const char *symbol) | 1334 | static bool sym_is(const char *name, unsigned namelen, const char *symbol) |
| 1292 | { | 1335 | { |
| @@ -1303,7 +1346,7 @@ static void do_table(void *symval, unsigned long size, | |||
| 1303 | struct module *mod) | 1346 | struct module *mod) |
| 1304 | { | 1347 | { |
| 1305 | unsigned int i; | 1348 | unsigned int i; |
| 1306 | char alias[500]; | 1349 | char alias[ALIAS_SIZE]; |
| 1307 | 1350 | ||
| 1308 | device_id_check(mod->name, device_id, size, id_size, symval); | 1351 | device_id_check(mod->name, device_id, size, id_size, symval); |
| 1309 | /* Leave last one: it's the terminator. */ | 1352 | /* Leave last one: it's the terminator. */ |
| @@ -1357,6 +1400,8 @@ static const struct devtable devtable[] = { | |||
| 1357 | {"fslmc", SIZE_fsl_mc_device_id, do_fsl_mc_entry}, | 1400 | {"fslmc", SIZE_fsl_mc_device_id, do_fsl_mc_entry}, |
| 1358 | {"tbsvc", SIZE_tb_service_id, do_tbsvc_entry}, | 1401 | {"tbsvc", SIZE_tb_service_id, do_tbsvc_entry}, |
| 1359 | {"typec", SIZE_typec_device_id, do_typec_entry}, | 1402 | {"typec", SIZE_typec_device_id, do_typec_entry}, |
| 1403 | {"tee", SIZE_tee_client_device_id, do_tee_entry}, | ||
| 1404 | {"wmi", SIZE_wmi_device_id, do_wmi_entry}, | ||
| 1360 | }; | 1405 | }; |
| 1361 | 1406 | ||
| 1362 | /* Create MODULE_ALIAS() statements. | 1407 | /* Create MODULE_ALIAS() statements. |
diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py index e559c6294c39..4fe392e507fb 100755 --- a/scripts/spdxcheck.py +++ b/scripts/spdxcheck.py | |||
| @@ -175,7 +175,13 @@ class id_parser(object): | |||
| 175 | self.lines_checked += 1 | 175 | self.lines_checked += 1 |
| 176 | if line.find("SPDX-License-Identifier:") < 0: | 176 | if line.find("SPDX-License-Identifier:") < 0: |
| 177 | continue | 177 | continue |
| 178 | expr = line.split(':')[1].replace('*/', '').strip() | 178 | expr = line.split(':')[1].strip() |
| 179 | # Remove trailing comment closure | ||
| 180 | if line.strip().endswith('*/'): | ||
| 181 | expr = expr.rstrip('*/').strip() | ||
| 182 | # Special case for SH magic boot code files | ||
| 183 | if line.startswith('LIST \"'): | ||
| 184 | expr = expr.rstrip('\"').strip() | ||
| 179 | self.parse(expr) | 185 | self.parse(expr) |
| 180 | self.spdx_valid += 1 | 186 | self.spdx_valid += 1 |
| 181 | # | 187 | # |
diff --git a/scripts/spelling.txt b/scripts/spelling.txt index 517d0c3f83df..86b87332b9e5 100644 --- a/scripts/spelling.txt +++ b/scripts/spelling.txt | |||
| @@ -10,6 +10,8 @@ | |||
| 10 | abandonning||abandoning | 10 | abandonning||abandoning |
| 11 | abigious||ambiguous | 11 | abigious||ambiguous |
| 12 | abitrate||arbitrate | 12 | abitrate||arbitrate |
| 13 | abnornally||abnormally | ||
| 14 | abnrormal||abnormal | ||
| 13 | abord||abort | 15 | abord||abort |
| 14 | aboslute||absolute | 16 | aboslute||absolute |
| 15 | abov||above | 17 | abov||above |
| @@ -107,6 +109,7 @@ ambigious||ambiguous | |||
| 107 | amoung||among | 109 | amoung||among |
| 108 | amout||amount | 110 | amout||amount |
| 109 | amplifer||amplifier | 111 | amplifer||amplifier |
| 112 | amplifyer||amplifier | ||
| 110 | an union||a union | 113 | an union||a union |
| 111 | an user||a user | 114 | an user||a user |
| 112 | an userspace||a userspace | 115 | an userspace||a userspace |
| @@ -145,6 +148,7 @@ artillary||artillery | |||
| 145 | asign||assign | 148 | asign||assign |
| 146 | asser||assert | 149 | asser||assert |
| 147 | assertation||assertion | 150 | assertation||assertion |
| 151 | assertting||asserting | ||
| 148 | assiged||assigned | 152 | assiged||assigned |
| 149 | assigment||assignment | 153 | assigment||assignment |
| 150 | assigments||assignments | 154 | assigments||assignments |
| @@ -168,6 +172,8 @@ attachement||attachment | |||
| 168 | attched||attached | 172 | attched||attached |
| 169 | attemps||attempts | 173 | attemps||attempts |
| 170 | attemping||attempting | 174 | attemping||attempting |
| 175 | attepmpt||attempt | ||
| 176 | attnetion||attention | ||
| 171 | attruibutes||attributes | 177 | attruibutes||attributes |
| 172 | authentification||authentication | 178 | authentification||authentication |
| 173 | automaticaly||automatically | 179 | automaticaly||automatically |
| @@ -217,6 +223,7 @@ boardcast||broadcast | |||
| 217 | borad||board | 223 | borad||board |
| 218 | boundry||boundary | 224 | boundry||boundary |
| 219 | brievely||briefly | 225 | brievely||briefly |
| 226 | broadcase||broadcast | ||
| 220 | broadcat||broadcast | 227 | broadcat||broadcast |
| 221 | bufufer||buffer | 228 | bufufer||buffer |
| 222 | cacluated||calculated | 229 | cacluated||calculated |
| @@ -234,6 +241,7 @@ cancle||cancel | |||
| 234 | capabilites||capabilities | 241 | capabilites||capabilities |
| 235 | capabilty||capability | 242 | capabilty||capability |
| 236 | capabitilies||capabilities | 243 | capabitilies||capabilities |
| 244 | capablity||capability | ||
| 237 | capatibilities||capabilities | 245 | capatibilities||capabilities |
| 238 | capapbilities||capabilities | 246 | capapbilities||capabilities |
| 239 | caputure||capture | 247 | caputure||capture |
| @@ -274,6 +282,7 @@ clared||cleared | |||
| 274 | closeing||closing | 282 | closeing||closing |
| 275 | clustred||clustered | 283 | clustred||clustered |
| 276 | coexistance||coexistence | 284 | coexistance||coexistence |
| 285 | colescing||coalescing | ||
| 277 | collapsable||collapsible | 286 | collapsable||collapsible |
| 278 | colorfull||colorful | 287 | colorfull||colorful |
| 279 | comand||command | 288 | comand||command |
| @@ -290,6 +299,7 @@ comsumer||consumer | |||
| 290 | comsuming||consuming | 299 | comsuming||consuming |
| 291 | compability||compatibility | 300 | compability||compatibility |
| 292 | compaibility||compatibility | 301 | compaibility||compatibility |
| 302 | comparsion||comparison | ||
| 293 | compatability||compatibility | 303 | compatability||compatibility |
| 294 | compatable||compatible | 304 | compatable||compatible |
| 295 | compatibiliy||compatibility | 305 | compatibiliy||compatibility |
| @@ -303,6 +313,7 @@ completly||completely | |||
| 303 | complient||compliant | 313 | complient||compliant |
| 304 | componnents||components | 314 | componnents||components |
| 305 | compoment||component | 315 | compoment||component |
| 316 | comppatible||compatible | ||
| 306 | compres||compress | 317 | compres||compress |
| 307 | compresion||compression | 318 | compresion||compression |
| 308 | comression||compression | 319 | comression||compression |
| @@ -368,6 +379,8 @@ decsribed||described | |||
| 368 | decription||description | 379 | decription||description |
| 369 | dectected||detected | 380 | dectected||detected |
| 370 | defailt||default | 381 | defailt||default |
| 382 | deferal||deferral | ||
| 383 | deffered||deferred | ||
| 371 | defferred||deferred | 384 | defferred||deferred |
| 372 | definate||definite | 385 | definate||definite |
| 373 | definately||definitely | 386 | definately||definitely |
| @@ -400,6 +413,7 @@ descritptor||descriptor | |||
| 400 | desctiptor||descriptor | 413 | desctiptor||descriptor |
| 401 | desriptor||descriptor | 414 | desriptor||descriptor |
| 402 | desriptors||descriptors | 415 | desriptors||descriptors |
| 416 | desination||destination | ||
| 403 | destionation||destination | 417 | destionation||destination |
| 404 | destoried||destroyed | 418 | destoried||destroyed |
| 405 | destory||destroy | 419 | destory||destroy |
| @@ -426,7 +440,9 @@ diffrent||different | |||
| 426 | differenciate||differentiate | 440 | differenciate||differentiate |
| 427 | diffrentiate||differentiate | 441 | diffrentiate||differentiate |
| 428 | difinition||definition | 442 | difinition||definition |
| 443 | dimention||dimension | ||
| 429 | dimesions||dimensions | 444 | dimesions||dimensions |
| 445 | dispalying||displaying | ||
| 430 | diplay||display | 446 | diplay||display |
| 431 | directon||direction | 447 | directon||direction |
| 432 | direectly||directly | 448 | direectly||directly |
| @@ -442,6 +458,7 @@ disbled||disabled | |||
| 442 | disconnet||disconnect | 458 | disconnet||disconnect |
| 443 | discontinous||discontinuous | 459 | discontinous||discontinuous |
| 444 | disharge||discharge | 460 | disharge||discharge |
| 461 | disnabled||disabled | ||
| 445 | dispertion||dispersion | 462 | dispertion||dispersion |
| 446 | dissapears||disappears | 463 | dissapears||disappears |
| 447 | distiction||distinction | 464 | distiction||distinction |
| @@ -456,6 +473,7 @@ dorp||drop | |||
| 456 | dosen||doesn | 473 | dosen||doesn |
| 457 | downlad||download | 474 | downlad||download |
| 458 | downlads||downloads | 475 | downlads||downloads |
| 476 | droped||dropped | ||
| 459 | druing||during | 477 | druing||during |
| 460 | dynmaic||dynamic | 478 | dynmaic||dynamic |
| 461 | eanable||enable | 479 | eanable||enable |
| @@ -471,6 +489,7 @@ elementry||elementary | |||
| 471 | eletronic||electronic | 489 | eletronic||electronic |
| 472 | embeded||embedded | 490 | embeded||embedded |
| 473 | enabledi||enabled | 491 | enabledi||enabled |
| 492 | enble||enable | ||
| 474 | enchanced||enhanced | 493 | enchanced||enhanced |
| 475 | encorporating||incorporating | 494 | encorporating||incorporating |
| 476 | encrupted||encrypted | 495 | encrupted||encrypted |
| @@ -479,6 +498,9 @@ encryptio||encryption | |||
| 479 | endianess||endianness | 498 | endianess||endianness |
| 480 | enhaced||enhanced | 499 | enhaced||enhanced |
| 481 | enlightnment||enlightenment | 500 | enlightnment||enlightenment |
| 501 | enqueing||enqueuing | ||
| 502 | entires||entries | ||
| 503 | entites||entities | ||
| 482 | entrys||entries | 504 | entrys||entries |
| 483 | enocded||encoded | 505 | enocded||encoded |
| 484 | enterily||entirely | 506 | enterily||entirely |
| @@ -498,6 +520,8 @@ etsbalishment||establishment | |||
| 498 | excecutable||executable | 520 | excecutable||executable |
| 499 | exceded||exceeded | 521 | exceded||exceeded |
| 500 | excellant||excellent | 522 | excellant||excellent |
| 523 | execeeded||exceeded | ||
| 524 | execeeds||exceeds | ||
| 501 | exeed||exceed | 525 | exeed||exceed |
| 502 | existance||existence | 526 | existance||existence |
| 503 | existant||existent | 527 | existant||existent |
| @@ -506,6 +530,7 @@ exlcude||exclude | |||
| 506 | exlcusive||exclusive | 530 | exlcusive||exclusive |
| 507 | exmaple||example | 531 | exmaple||example |
| 508 | expecially||especially | 532 | expecially||especially |
| 533 | experies||expires | ||
| 509 | explicite||explicit | 534 | explicite||explicit |
| 510 | explicitely||explicitly | 535 | explicitely||explicitly |
| 511 | explict||explicit | 536 | explict||explicit |
| @@ -521,6 +546,7 @@ extracter||extractor | |||
| 521 | faield||failed | 546 | faield||failed |
| 522 | falied||failed | 547 | falied||failed |
| 523 | faild||failed | 548 | faild||failed |
| 549 | failded||failed | ||
| 524 | failer||failure | 550 | failer||failure |
| 525 | faill||fail | 551 | faill||fail |
| 526 | failied||failed | 552 | failied||failed |
| @@ -540,6 +566,7 @@ fetaure||feature | |||
| 540 | fetaures||features | 566 | fetaures||features |
| 541 | fileystem||filesystem | 567 | fileystem||filesystem |
| 542 | fimware||firmware | 568 | fimware||firmware |
| 569 | firmare||firmware | ||
| 543 | firware||firmware | 570 | firware||firmware |
| 544 | finanize||finalize | 571 | finanize||finalize |
| 545 | findn||find | 572 | findn||find |
| @@ -574,6 +601,7 @@ funtions||functions | |||
| 574 | furthur||further | 601 | furthur||further |
| 575 | futhermore||furthermore | 602 | futhermore||furthermore |
| 576 | futrue||future | 603 | futrue||future |
| 604 | gauage||gauge | ||
| 577 | gaurenteed||guaranteed | 605 | gaurenteed||guaranteed |
| 578 | generiously||generously | 606 | generiously||generously |
| 579 | genereate||generate | 607 | genereate||generate |
| @@ -645,6 +673,7 @@ independed||independent | |||
| 645 | indiate||indicate | 673 | indiate||indicate |
| 646 | indicat||indicate | 674 | indicat||indicate |
| 647 | inexpect||inexpected | 675 | inexpect||inexpected |
| 676 | inferface||interface | ||
| 648 | infomation||information | 677 | infomation||information |
| 649 | informatiom||information | 678 | informatiom||information |
| 650 | informations||information | 679 | informations||information |
| @@ -662,14 +691,17 @@ initialiazation||initialization | |||
| 662 | initializiation||initialization | 691 | initializiation||initialization |
| 663 | initialze||initialize | 692 | initialze||initialize |
| 664 | initialzed||initialized | 693 | initialzed||initialized |
| 694 | initialzing||initializing | ||
| 665 | initilization||initialization | 695 | initilization||initialization |
| 666 | initilize||initialize | 696 | initilize||initialize |
| 667 | inofficial||unofficial | 697 | inofficial||unofficial |
| 668 | inrerface||interface | 698 | inrerface||interface |
| 669 | insititute||institute | 699 | insititute||institute |
| 700 | instace||instance | ||
| 670 | instal||install | 701 | instal||install |
| 671 | instanciate||instantiate | 702 | instanciate||instantiate |
| 672 | instanciated||instantiated | 703 | instanciated||instantiated |
| 704 | insufficent||insufficient | ||
| 673 | inteface||interface | 705 | inteface||interface |
| 674 | integreated||integrated | 706 | integreated||integrated |
| 675 | integrety||integrity | 707 | integrety||integrity |
| @@ -684,6 +716,8 @@ intermittant||intermittent | |||
| 684 | internel||internal | 716 | internel||internal |
| 685 | interoprability||interoperability | 717 | interoprability||interoperability |
| 686 | interuupt||interrupt | 718 | interuupt||interrupt |
| 719 | interupt||interrupt | ||
| 720 | interupts||interrupts | ||
| 687 | interrface||interface | 721 | interrface||interface |
| 688 | interrrupt||interrupt | 722 | interrrupt||interrupt |
| 689 | interrup||interrupt | 723 | interrup||interrupt |
| @@ -699,11 +733,14 @@ intialization||initialization | |||
| 699 | intialized||initialized | 733 | intialized||initialized |
| 700 | intialize||initialize | 734 | intialize||initialize |
| 701 | intregral||integral | 735 | intregral||integral |
| 736 | intrerrupt||interrupt | ||
| 702 | intrrupt||interrupt | 737 | intrrupt||interrupt |
| 703 | intterrupt||interrupt | 738 | intterrupt||interrupt |
| 704 | intuative||intuitive | 739 | intuative||intuitive |
| 705 | inavlid||invalid | 740 | inavlid||invalid |
| 706 | invaid||invalid | 741 | invaid||invalid |
| 742 | invaild||invalid | ||
| 743 | invailid||invalid | ||
| 707 | invald||invalid | 744 | invald||invalid |
| 708 | invalde||invalid | 745 | invalde||invalid |
| 709 | invalide||invalid | 746 | invalide||invalid |
| @@ -712,6 +749,7 @@ invalud||invalid | |||
| 712 | invididual||individual | 749 | invididual||individual |
| 713 | invokation||invocation | 750 | invokation||invocation |
| 714 | invokations||invocations | 751 | invokations||invocations |
| 752 | ireelevant||irrelevant | ||
| 715 | irrelevent||irrelevant | 753 | irrelevent||irrelevant |
| 716 | isnt||isn't | 754 | isnt||isn't |
| 717 | isssue||issue | 755 | isssue||issue |
| @@ -747,6 +785,7 @@ loobpack||loopback | |||
| 747 | loosing||losing | 785 | loosing||losing |
| 748 | losted||lost | 786 | losted||lost |
| 749 | machinary||machinery | 787 | machinary||machinery |
| 788 | maibox||mailbox | ||
| 750 | maintainance||maintenance | 789 | maintainance||maintenance |
| 751 | maintainence||maintenance | 790 | maintainence||maintenance |
| 752 | maintan||maintain | 791 | maintan||maintain |
| @@ -758,14 +797,19 @@ managable||manageable | |||
| 758 | managment||management | 797 | managment||management |
| 759 | mangement||management | 798 | mangement||management |
| 760 | manoeuvering||maneuvering | 799 | manoeuvering||maneuvering |
| 800 | manufaucturing||manufacturing | ||
| 761 | mappping||mapping | 801 | mappping||mapping |
| 762 | matchs||matches | 802 | matchs||matches |
| 763 | mathimatical||mathematical | 803 | mathimatical||mathematical |
| 764 | mathimatic||mathematic | 804 | mathimatic||mathematic |
| 765 | mathimatics||mathematics | 805 | mathimatics||mathematics |
| 806 | maximium||maximum | ||
| 766 | maxium||maximum | 807 | maxium||maximum |
| 767 | mechamism||mechanism | 808 | mechamism||mechanism |
| 768 | meetign||meeting | 809 | meetign||meeting |
| 810 | memeory||memory | ||
| 811 | memmber||member | ||
| 812 | memoery||memory | ||
| 769 | ment||meant | 813 | ment||meant |
| 770 | mergable||mergeable | 814 | mergable||mergeable |
| 771 | mesage||message | 815 | mesage||message |
| @@ -779,6 +823,7 @@ migrateable||migratable | |||
| 779 | milliseonds||milliseconds | 823 | milliseonds||milliseconds |
| 780 | minium||minimum | 824 | minium||minimum |
| 781 | minimam||minimum | 825 | minimam||minimum |
| 826 | miniumum||minimum | ||
| 782 | minumum||minimum | 827 | minumum||minimum |
| 783 | misalinged||misaligned | 828 | misalinged||misaligned |
| 784 | miscelleneous||miscellaneous | 829 | miscelleneous||miscellaneous |
| @@ -839,6 +884,7 @@ occurence||occurrence | |||
| 839 | occure||occurred | 884 | occure||occurred |
| 840 | occured||occurred | 885 | occured||occurred |
| 841 | occuring||occurring | 886 | occuring||occurring |
| 887 | offser||offset | ||
| 842 | offet||offset | 888 | offet||offset |
| 843 | offloded||offloaded | 889 | offloded||offloaded |
| 844 | omited||omitted | 890 | omited||omitted |
| @@ -855,6 +901,7 @@ optmizations||optimizations | |||
| 855 | orientatied||orientated | 901 | orientatied||orientated |
| 856 | orientied||oriented | 902 | orientied||oriented |
| 857 | orignal||original | 903 | orignal||original |
| 904 | originial||original | ||
| 858 | otherise||otherwise | 905 | otherise||otherwise |
| 859 | ouput||output | 906 | ouput||output |
| 860 | oustanding||outstanding | 907 | oustanding||outstanding |
| @@ -874,6 +921,7 @@ packege||package | |||
| 874 | packge||package | 921 | packge||package |
| 875 | packtes||packets | 922 | packtes||packets |
| 876 | pakage||package | 923 | pakage||package |
| 924 | paket||packet | ||
| 877 | pallette||palette | 925 | pallette||palette |
| 878 | paln||plan | 926 | paln||plan |
| 879 | paramameters||parameters | 927 | paramameters||parameters |
| @@ -886,6 +934,8 @@ paramters||parameters | |||
| 886 | parmaters||parameters | 934 | parmaters||parameters |
| 887 | particuarly||particularly | 935 | particuarly||particularly |
| 888 | particularily||particularly | 936 | particularily||particularly |
| 937 | partion||partition | ||
| 938 | partions||partitions | ||
| 889 | partiton||partition | 939 | partiton||partition |
| 890 | pased||passed | 940 | pased||passed |
| 891 | passin||passing | 941 | passin||passing |
| @@ -897,10 +947,12 @@ peice||piece | |||
| 897 | pendantic||pedantic | 947 | pendantic||pedantic |
| 898 | peprocessor||preprocessor | 948 | peprocessor||preprocessor |
| 899 | perfoming||performing | 949 | perfoming||performing |
| 950 | peripherial||peripheral | ||
| 900 | permissons||permissions | 951 | permissons||permissions |
| 901 | peroid||period | 952 | peroid||period |
| 902 | persistance||persistence | 953 | persistance||persistence |
| 903 | persistant||persistent | 954 | persistant||persistent |
| 955 | phoneticly||phonetically | ||
| 904 | plalform||platform | 956 | plalform||platform |
| 905 | platfoem||platform | 957 | platfoem||platform |
| 906 | platfrom||platform | 958 | platfrom||platform |
| @@ -915,6 +967,7 @@ posible||possible | |||
| 915 | positon||position | 967 | positon||position |
| 916 | possibilites||possibilities | 968 | possibilites||possibilities |
| 917 | powerfull||powerful | 969 | powerfull||powerful |
| 970 | pramater||parameter | ||
| 918 | preamle||preamble | 971 | preamle||preamble |
| 919 | preample||preamble | 972 | preample||preamble |
| 920 | preapre||prepare | 973 | preapre||prepare |
| @@ -976,6 +1029,7 @@ psudo||pseudo | |||
| 976 | psuedo||pseudo | 1029 | psuedo||pseudo |
| 977 | psychadelic||psychedelic | 1030 | psychadelic||psychedelic |
| 978 | pwoer||power | 1031 | pwoer||power |
| 1032 | queing||queuing | ||
| 979 | quering||querying | 1033 | quering||querying |
| 980 | randomally||randomly | 1034 | randomally||randomly |
| 981 | raoming||roaming | 1035 | raoming||roaming |
| @@ -1004,6 +1058,7 @@ refering||referring | |||
| 1004 | refernces||references | 1058 | refernces||references |
| 1005 | refernnce||reference | 1059 | refernnce||reference |
| 1006 | refrence||reference | 1060 | refrence||reference |
| 1061 | registed||registered | ||
| 1007 | registerd||registered | 1062 | registerd||registered |
| 1008 | registeration||registration | 1063 | registeration||registration |
| 1009 | registeresd||registered | 1064 | registeresd||registered |
| @@ -1018,6 +1073,7 @@ regulamentations||regulations | |||
| 1018 | reigstration||registration | 1073 | reigstration||registration |
| 1019 | releated||related | 1074 | releated||related |
| 1020 | relevent||relevant | 1075 | relevent||relevant |
| 1076 | reloade||reload | ||
| 1021 | remoote||remote | 1077 | remoote||remote |
| 1022 | remore||remote | 1078 | remore||remote |
| 1023 | removeable||removable | 1079 | removeable||removable |
| @@ -1036,19 +1092,23 @@ requried||required | |||
| 1036 | requst||request | 1092 | requst||request |
| 1037 | reregisteration||reregistration | 1093 | reregisteration||reregistration |
| 1038 | reseting||resetting | 1094 | reseting||resetting |
| 1095 | reseved||reserved | ||
| 1039 | reseverd||reserved | 1096 | reseverd||reserved |
| 1040 | resizeable||resizable | 1097 | resizeable||resizable |
| 1041 | resouce||resource | 1098 | resouce||resource |
| 1042 | resouces||resources | 1099 | resouces||resources |
| 1043 | resoures||resources | 1100 | resoures||resources |
| 1044 | responce||response | 1101 | responce||response |
| 1102 | resrouce||resource | ||
| 1045 | ressizes||resizes | 1103 | ressizes||resizes |
| 1046 | ressource||resource | 1104 | ressource||resource |
| 1047 | ressources||resources | 1105 | ressources||resources |
| 1048 | restesting||retesting | 1106 | restesting||retesting |
| 1107 | resumbmitting||resubmitting | ||
| 1049 | retransmited||retransmitted | 1108 | retransmited||retransmitted |
| 1050 | retreived||retrieved | 1109 | retreived||retrieved |
| 1051 | retreive||retrieve | 1110 | retreive||retrieve |
| 1111 | retreiving||retrieving | ||
| 1052 | retrive||retrieve | 1112 | retrive||retrieve |
| 1053 | retuned||returned | 1113 | retuned||returned |
| 1054 | reudce||reduce | 1114 | reudce||reduce |
| @@ -1120,6 +1180,7 @@ sleeped||slept | |||
| 1120 | softwares||software | 1180 | softwares||software |
| 1121 | speach||speech | 1181 | speach||speech |
| 1122 | specfic||specific | 1182 | specfic||specific |
| 1183 | specfield||specified | ||
| 1123 | speciefied||specified | 1184 | speciefied||specified |
| 1124 | specifc||specific | 1185 | specifc||specific |
| 1125 | specifed||specified | 1186 | specifed||specified |
| @@ -1142,7 +1203,10 @@ staion||station | |||
| 1142 | standardss||standards | 1203 | standardss||standards |
| 1143 | standartization||standardization | 1204 | standartization||standardization |
| 1144 | standart||standard | 1205 | standart||standard |
| 1206 | standy||standby | ||
| 1207 | stardard||standard | ||
| 1145 | staticly||statically | 1208 | staticly||statically |
| 1209 | statuss||status | ||
| 1146 | stoped||stopped | 1210 | stoped||stopped |
| 1147 | stoping||stopping | 1211 | stoping||stopping |
| 1148 | stoppped||stopped | 1212 | stoppped||stopped |
| @@ -1227,12 +1291,14 @@ tipically||typically | |||
| 1227 | timeing||timing | 1291 | timeing||timing |
| 1228 | timout||timeout | 1292 | timout||timeout |
| 1229 | tmis||this | 1293 | tmis||this |
| 1294 | toogle||toggle | ||
| 1230 | torerable||tolerable | 1295 | torerable||tolerable |
| 1231 | traking||tracking | 1296 | traking||tracking |
| 1232 | tramsmitted||transmitted | 1297 | tramsmitted||transmitted |
| 1233 | tramsmit||transmit | 1298 | tramsmit||transmit |
| 1234 | tranasction||transaction | 1299 | tranasction||transaction |
| 1235 | tranfer||transfer | 1300 | tranfer||transfer |
| 1301 | transcevier||transceiver | ||
| 1236 | transciever||transceiver | 1302 | transciever||transceiver |
| 1237 | transferd||transferred | 1303 | transferd||transferred |
| 1238 | transfered||transferred | 1304 | transfered||transferred |
| @@ -1267,6 +1333,7 @@ unfortunatelly||unfortunately | |||
| 1267 | unifiy||unify | 1333 | unifiy||unify |
| 1268 | uniterrupted||uninterrupted | 1334 | uniterrupted||uninterrupted |
| 1269 | unintialized||uninitialized | 1335 | unintialized||uninitialized |
| 1336 | unitialized||uninitialized | ||
| 1270 | unkmown||unknown | 1337 | unkmown||unknown |
| 1271 | unknonw||unknown | 1338 | unknonw||unknown |
| 1272 | unknow||unknown | 1339 | unknow||unknown |
| @@ -1291,7 +1358,9 @@ unsuccessfull||unsuccessful | |||
| 1291 | unsuported||unsupported | 1358 | unsuported||unsupported |
| 1292 | untill||until | 1359 | untill||until |
| 1293 | unuseful||useless | 1360 | unuseful||useless |
| 1361 | unvalid||invalid | ||
| 1294 | upate||update | 1362 | upate||update |
| 1363 | upsupported||unsupported | ||
| 1295 | usefule||useful | 1364 | usefule||useful |
| 1296 | usefull||useful | 1365 | usefull||useful |
| 1297 | usege||usage | 1366 | usege||usage |
diff --git a/scripts/ver_linux b/scripts/ver_linux index a6c728db05ce..810e608baa24 100755 --- a/scripts/ver_linux +++ b/scripts/ver_linux | |||
| @@ -13,6 +13,8 @@ BEGIN { | |||
| 13 | system("uname -a") | 13 | system("uname -a") |
| 14 | printf("\n") | 14 | printf("\n") |
| 15 | 15 | ||
| 16 | vernum = "[0-9]+([.]?[0-9]+)+" | ||
| 17 | |||
| 16 | printversion("GNU C", version("gcc -dumpversion")) | 18 | printversion("GNU C", version("gcc -dumpversion")) |
| 17 | printversion("GNU Make", version("make --version")) | 19 | printversion("GNU Make", version("make --version")) |
| 18 | printversion("Binutils", version("ld -v")) | 20 | printversion("Binutils", version("ld -v")) |
| @@ -34,7 +36,7 @@ BEGIN { | |||
| 34 | while (getline <"/proc/self/maps" > 0) { | 36 | while (getline <"/proc/self/maps" > 0) { |
| 35 | if (/libc.*\.so$/) { | 37 | if (/libc.*\.so$/) { |
| 36 | n = split($0, procmaps, "/") | 38 | n = split($0, procmaps, "/") |
| 37 | if (match(procmaps[n], /[0-9]+([.]?[0-9]+)+/)) { | 39 | if (match(procmaps[n], vernum)) { |
| 38 | ver = substr(procmaps[n], RSTART, RLENGTH) | 40 | ver = substr(procmaps[n], RSTART, RLENGTH) |
| 39 | printversion("Linux C Library", ver) | 41 | printversion("Linux C Library", ver) |
| 40 | break | 42 | break |
| @@ -70,7 +72,7 @@ BEGIN { | |||
| 70 | function version(cmd, ver) { | 72 | function version(cmd, ver) { |
| 71 | cmd = cmd " 2>&1" | 73 | cmd = cmd " 2>&1" |
| 72 | while (cmd | getline > 0) { | 74 | while (cmd | getline > 0) { |
| 73 | if (match($0, /[0-9]+([.]?[0-9]+)+/)) { | 75 | if (match($0, vernum)) { |
| 74 | ver = substr($0, RSTART, RLENGTH) | 76 | ver = substr($0, RSTART, RLENGTH) |
| 75 | break | 77 | break |
| 76 | } | 78 | } |
