action.yml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. name: Verify ABI/KMI safeguards
  2. description: Capture or verify hashes of source ABI/KMI protection files
  3. inputs:
  4. mode:
  5. description: 'capture or verify'
  6. required: true
  7. runs:
  8. using: composite
  9. steps:
  10. - name: Capture or verify protected files
  11. shell: bash
  12. run: |
  13. set -euo pipefail
  14. root="${{ github.workspace }}/kernel"
  15. manifest="${{ github.workspace }}/.abi-kmi-safeguards.sha256"
  16. snapshot="$(mktemp)"
  17. while IFS= read -r -d '' path; do
  18. sha256sum "$path"
  19. done < <(
  20. find "$root" -type f \( \
  21. -path '*/android/abi_gki_*' -o \
  22. -path '*/build/abi/*' -o \
  23. -path '*/gki/*/abi.stg' -o \
  24. -path '*/gki/*/symbols/*' -o \
  25. -path '*/modules.bzl' -o \
  26. -path '*/BUILD.bazel' \
  27. \) -print0 | sort -z
  28. ) > "$snapshot"
  29. if [ ! -s "$snapshot" ]; then
  30. echo "No ABI/KMI protection files were found; refusing an unguarded build." >&2
  31. exit 1
  32. fi
  33. case "${{ inputs.mode }}" in
  34. capture)
  35. mv "$snapshot" "$manifest"
  36. ;;
  37. verify)
  38. if [ ! -f "$manifest" ]; then
  39. echo "ABI/KMI safeguard manifest is missing." >&2
  40. exit 1
  41. fi
  42. if ! cmp -s "$manifest" "$snapshot"; then
  43. echo "ABI/KMI protection files changed during integration." >&2
  44. diff -u "$manifest" "$snapshot" >&2 || true
  45. exit 1
  46. fi
  47. rm -f "$snapshot"
  48. ;;
  49. *)
  50. echo "Unsupported safeguard mode: ${{ inputs.mode }}" >&2
  51. exit 2
  52. ;;
  53. esac