]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - debian/scripts/retpoline-extract
x86/speculation/mds: Add mitigation control for MDS
[mirror_ubuntu-bionic-kernel.git] / debian / scripts / retpoline-extract
index c401f2f72354e448a93032d8fc1fc37b6206f234..cf13a30b1c62eaa558b60c24eb9db97ccbc4afb2 100755 (executable)
@@ -2,12 +2,22 @@
 
 cd "$1" || exit 1
 
-{
-       echo "./vmlinux"
-       find . -name \*.ko
-} | xargs objdump --disassemble | \
-awk -F'        ' '
-       /^.\//                          { file=$1; sub(":.*", "", file); sub("^.*/", "", file); }
-       /^[0-9a-f][0-9a-f]* <.*>:/      { tag=$1; sub(".*<", "", tag); sub(">.*", "", tag); tag=file " " tag; }
-       $3 ~ /(callq|jmpq)  *\*%/       { print(tag " " $3); }
-'
+# Find all valid retpoline information, collate the detected and
+# safe information together.  Join the result to find the detected
+# but non-safe elements.  These are our concern.
+ur_detected=$(mktemp --tmpdir "retpoline-check-XXXXXX.ur-detected")
+ur_safe=$(mktemp --tmpdir "retpoline-check-XXXXXX.ur-safe")
+
+find "." -path './drivers/firmware/efi/libstub' -prune -o \
+        -path './arch/x86/boot' -prune -o \
+        -path './arch/x86/purgatory' -prune -o \
+        -name \*.ur-detected -print0 | xargs -0 cat | \
+       sed -e "s@^$1@@" -e "s@ $2/@ @" -e "s@^/@@" | \
+       sort -k 1b,1 >"$ur_detected"
+find "." -name \*.ur-safe -print0 | xargs -0 cat | \
+       sed -e "s@^$1@@" -e "s@^/@@" | \
+       sort -k 1b,1 >"$ur_safe"
+
+join -v 1 -j 1 "$ur_detected" "$ur_safe" | sed -s 's/[^ ]*  *//'
+
+rm -f "$ur_detected" "$ur_safe"