From 3f36cba2dee096835ac2a4c3ced11684e38a6532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B0=E6=9C=94?= <565183519@qq.com> Date: Mon, 3 Aug 2026 21:11:10 +0800 Subject: [PATCH] fix(recovery): clear sealed failed probe range Verify the exact failed candidate and proof receipts before restoring JD LBAs 105 through 134 to a zero readback state for a hardware-adapter retry. --- .../scripts/clear-jd-native-probe-proof.sh | 34 +++++++++++++++---- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/product-source/hololake-platform/guanghu-os/scripts/clear-jd-native-probe-proof.sh b/product-source/hololake-platform/guanghu-os/scripts/clear-jd-native-probe-proof.sh index 676ebfc..ca5020e 100755 --- a/product-source/hololake-platform/guanghu-os/scripts/clear-jd-native-probe-proof.sh +++ b/product-source/hololake-platform/guanghu-os/scripts/clear-jd-native-probe-proof.sh @@ -20,15 +20,28 @@ expected_sha=$(awk '/^ proof_sha256:/ {print $2}' \ "${recovery_root}/RETURN-RECEIPT.hldp") [[ ${expected_sha} =~ ^[0-9a-f]{64}$ ]] [[ $(sha256sum "${proof}" | awk '{print $1}') == "${expected_sha}" ]] -[[ $(dd if=/dev/vda bs=512 skip=134 count=1 status=none | sha256sum | - awk '{print $1}') == "${expected_sha}" ]] +candidate_sha=$(awk '/^ sha256:/ {print $2; exit}' \ + "${recovery_root}/PREPARE-RECEIPT.hldp") +[[ ${candidate_sha} =~ ^[0-9a-f]{64}$ ]] +[[ $(dd if=/dev/vda bs=512 skip=105 count=29 status=none | sha256sum | + awk '{print $1}') == "${candidate_sha}" ]] -dd if=/dev/zero of=/dev/vda bs=512 seek=134 count=1 conv=notrunc,fsync \ - status=none -zero_sha=$(head -c 512 /dev/zero | sha256sum | awk '{print $1}') -readback_sha=$(dd if=/dev/vda bs=512 skip=134 count=1 status=none | +current_proof_sha=$(dd if=/dev/vda bs=512 skip=134 count=1 status=none | sha256sum | awk '{print $1}') -[[ ${readback_sha} == "${zero_sha}" ]] +zero_sector_sha=$(head -c 512 /dev/zero | sha256sum | awk '{print $1}') +if [[ ${current_proof_sha} != "${expected_sha}" ]]; then + grep -q "^ sealed_sha256: ${expected_sha}$" \ + "${recovery_root}/PROOF-CLEAR-RECEIPT.hldp" + [[ ${current_proof_sha} == "${zero_sector_sha}" ]] +fi + +dd if=/dev/zero of=/dev/vda bs=512 seek=105 count=30 conv=notrunc,fsync \ + status=none +zero_range_sha=$(head -c $((30 * 512)) /dev/zero | sha256sum | + awk '{print $1}') +readback_sha=$(dd if=/dev/vda bs=512 skip=105 count=30 status=none | + sha256sum | awk '{print $1}') +[[ ${readback_sha} == "${zero_range_sha}" ]] observed_at=$(date --iso-8601=seconds) cat >"${recovery_root}/PROOF-CLEAR-RECEIPT.hldp" <