When checking a kernel version to see if errata should be set, also check the kernel extraversion, if given in the errata.txt. Also, reformat errata.txt to allow for longer version names and to remove the tabs. Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx> --- errata.txt | 14 +++++++------- scripts/arch-run.bash | 36 +++++++++++++++++++++++++++++++----- 2 files changed, 38 insertions(+), 12 deletions(-) diff --git a/errata.txt b/errata.txt index 5608a308ce7c..b943695173e0 100644 --- a/errata.txt +++ b/errata.txt @@ -1,7 +1,7 @@ -#---------------:-----------------------:-------------------------------------- -# commit : minimum kernel : summary -# 12 hex digits : version : -#---------------:-----------------------:-------------------------------------- -9e3f7a296940 : 4.9 : arm64: KVM: pmu: Fix AArch32 cycle counter access -6c7a5dce22b3 : 4.12 : KVM: arm/arm64: fix races in kvm_psci_vcpu_on -#---------------:-----------------------:-------------------------------------- +#---------------:-------------------------------:--------------------------------------------------- +# commit : minimum kernel : summary +# 12 hex digits : version : +#---------------:-------------------------------:--------------------------------------------------- +9e3f7a296940 : 4.9 : arm64: KVM: pmu: Fix AArch32 cycle counter access +6c7a5dce22b3 : 4.12 : KVM: arm/arm64: fix races in kvm_psci_vcpu_on +#---------------:-------------------------------:--------------------------------------------------- diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash index 7c6c79ad3a9d..8cea8c49d847 100644 --- a/scripts/arch-run.bash +++ b/scripts/arch-run.bash @@ -189,11 +189,16 @@ env_add_errata () env_generate_errata () { local kernel_version_string=$(uname -r) - local kernel_version kernel_patchlevel kernel_sublevel - local line commit minver errata v p s have + local kernel_version kernel_patchlevel kernel_sublevel kernel_extraversion + local line commit minver errata rest v p s x have - IFS=. read kernel_version kernel_patchlevel kernel_sublevel <<<$kernel_version_string + IFS=. read kernel_version kernel_patchlevel rest <<<$kernel_version_string + IFS=- read kernel_sublevel kernel_extraversion <<<$rest kernel_sublevel=${kernel_sublevel%%[!0-9]*} + kernel_extraversion=${kernel_extraversion%%[!0-9]*} + + ! [[ $kernel_sublevel =~ ^[0-9]+$ ]] && unset $kernel_sublevel + ! [[ $kernel_extraversion =~ ^[0-9]+$ ]] && unset $kernel_extraversion [ "$ENVIRON_DEFAULT" != "yes" ] && return [ ! -f "$ERRATATXT" ] && return @@ -205,16 +210,37 @@ env_generate_errata () errata="ERRATA_$commit" test -v $errata && continue - IFS=. read v p s <<<$minver + IFS=. read v p rest <<<$minver + IFS=- read s x <<<$rest s=${s%%[!0-9]*} + x=${x%%[!0-9]*} + + if ! [[ $v =~ ^[0-9]+$ ]] || ! [[ $p =~ ^[0-9]+$ ]]; then + echo "Bad minimum kernel version in $ERRATATXT, $minver" + exit 2 + fi + ! [[ $s =~ ^[0-9]+$ ]] && unset $s + ! [[ $x =~ ^[0-9]+$ ]] && unset $x if (( $kernel_version > $v || ($kernel_version == $v && $kernel_patchlevel > $p) )); then have=y elif (( $kernel_version == $v && $kernel_patchlevel == $p )); then if [ "$kernel_sublevel" ] && [ "$s" ]; then - if (( $kernel_sublevel >= $s )); then + if (( $kernel_sublevel > $s )); then have=y + elif (( $kernel_sublevel == $s )); then + if [ "$kernel_extraversion" ] && [ "$x" ]; then + if (( $kernel_extraversion >= $x )); then + have=y + else + have=n + fi + elif [ "$x" ] && (( $x != 0 )); then + have=n + else + have=y + fi else have=n fi -- 1.8.3.1