mirror of
https://github.com/rustfs/rustfs.git
synced 2026-12-02 22:26:21 +00:00
0e326157cc
* fix(heal): explain why durable MRF proof is unavailable Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> * fix(heal): retire held MRF writes with bounded absence probes Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> * perf(heal): reduce held MRF probe and scan overhead Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> * perf(heal): isolate MRF retirement reads from durable admission Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> * perf(heal): batch exact MRF receipt matching Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> * fix(ecstore): use the namespace contract in MRF probes Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> * perf(heal): build MRF checkpoint records in one pass Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> * test(heal): pin durable MRF proof rejection semantics Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> * perf(heal): share bucket lookups within durable MRF dispatch Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> * ci(fuzz): isolate harness dependency groups during builds Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> * ci(fuzz): keep group artifacts available across reruns Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> * ci(fuzz): validate target bindings by job Co-Authored-By: heihutu <heihutu@gmail.com> Co-Authored-By: zhi22915 <qiuzgang@gmail.com> Co-Authored-By: qunjiazhu <qunjiazhu@gmail.com> --------- Co-authored-by: heihutu <heihutu@gmail.com> Co-authored-by: zhi22915 <qiuzgang@gmail.com> Co-authored-by: qunjiazhu <qunjiazhu@gmail.com>
224 lines
8.0 KiB
Bash
Executable File
224 lines
8.0 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
set -eu
|
|
|
|
SCRIPT_DIR=$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd)
|
|
REPO_ROOT=$(CDPATH='' cd -- "$SCRIPT_DIR/.." && pwd)
|
|
TMP_ROOT=$(mktemp -d)
|
|
trap 'rm -rf "$TMP_ROOT"' EXIT HUP INT TERM
|
|
|
|
mkdir -p "$TMP_ROOT/bin"
|
|
for target in path_containment sigv4_request notify_xml; do
|
|
cat > "$TMP_ROOT/bin/$target" <<'EOF'
|
|
#!/bin/sh
|
|
printf '%s\n' "$@" > "$FAKE_ARGS_FILE"
|
|
if [ "${FAKE_FAIL:-0}" = "1" ]; then
|
|
for arg in "$@"; do
|
|
case "$arg" in
|
|
-artifact_prefix=*)
|
|
prefix=${arg#-artifact_prefix=}
|
|
printf 'synthetic-crash-input' > "${prefix}crash-deadbeef"
|
|
;;
|
|
esac
|
|
done
|
|
exit 77
|
|
fi
|
|
EOF
|
|
chmod +x "$TMP_ROOT/bin/$target"
|
|
done
|
|
|
|
EXPLICIT_ARTIFACTS="$TMP_ROOT/explicit-artifacts"
|
|
FAKE_ARGS_FILE="$TMP_ROOT/explicit-args" \
|
|
FUZZ_TARGET=sigv4_request \
|
|
FUZZ_SEED=123456789 \
|
|
MAX_TOTAL_TIME=7 \
|
|
ARTIFACT_ROOT="$EXPLICIT_ARTIFACTS" \
|
|
SKIP_BUILD=1 \
|
|
USE_PREBUILT_BINARY=1 \
|
|
PREBUILT_BINARY_DIR="$TMP_ROOT/bin" \
|
|
"$REPO_ROOT/scripts/fuzz/run.sh"
|
|
|
|
EXPLICIT_MANIFEST="$EXPLICIT_ARTIFACTS/sigv4_request/run-manifest.txt"
|
|
EXPLICIT_SUMMARY="$EXPLICIT_ARTIFACTS/sigv4_request/run-summary.json"
|
|
test -f "$EXPLICIT_MANIFEST"
|
|
test -f "$EXPLICIT_SUMMARY"
|
|
grep -Fx -- '-seed=123456789' "$TMP_ROOT/explicit-args"
|
|
grep -Fx 'target=sigv4_request' "$EXPLICIT_MANIFEST"
|
|
grep -Fx 'seed=123456789' "$EXPLICIT_MANIFEST"
|
|
grep -Fx 'max_total_time=7' "$EXPLICIT_MANIFEST"
|
|
grep -Fx 'exit_code=0' "$EXPLICIT_MANIFEST"
|
|
grep -E '^corpus_sha256=[0-9a-f]{64}$' "$EXPLICIT_MANIFEST"
|
|
grep -Fx "git_revision=$(git -C "$REPO_ROOT" rev-parse HEAD)" "$EXPLICIT_MANIFEST"
|
|
grep -E '^git_dirty=(true|false)$' "$EXPLICIT_MANIFEST"
|
|
grep -Fx 'runner_mode=prebuilt' "$EXPLICIT_MANIFEST"
|
|
python3 - "$EXPLICIT_SUMMARY" <<'PY'
|
|
import json, pathlib, sys
|
|
data = json.loads(pathlib.Path(sys.argv[1]).read_text())
|
|
assert data["schema_version"] == 1
|
|
assert data["target"] == "sigv4_request"
|
|
assert data["seed"] == 123456789
|
|
assert data["exit_code"] == 0
|
|
assert data["corpus_files"] >= 6
|
|
assert len(data["corpus_sha256"]) == 64
|
|
assert data["reproducer_sha256"] is None
|
|
PY
|
|
|
|
AUTO_ARTIFACTS="$TMP_ROOT/auto-artifacts"
|
|
FAKE_ARGS_FILE="$TMP_ROOT/auto-args" \
|
|
FUZZ_TARGET=notify_xml \
|
|
MAX_TOTAL_TIME=1 \
|
|
ARTIFACT_ROOT="$AUTO_ARTIFACTS" \
|
|
SKIP_BUILD=1 \
|
|
USE_PREBUILT_BINARY=1 \
|
|
PREBUILT_BINARY_DIR="$TMP_ROOT/bin" \
|
|
"$REPO_ROOT/scripts/fuzz/run.sh"
|
|
|
|
AUTO_MANIFEST="$AUTO_ARTIFACTS/notify_xml/run-manifest.txt"
|
|
auto_seed=$(sed -n 's/^seed=//p' "$AUTO_MANIFEST")
|
|
case "$auto_seed" in
|
|
''|*[!0-9]*)
|
|
echo "automatic seed was not recorded as an unsigned decimal integer: $auto_seed" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
grep -Fx -- "-seed=$auto_seed" "$TMP_ROOT/auto-args"
|
|
|
|
CRASH_ARTIFACTS="$TMP_ROOT/crash-artifacts"
|
|
if FAKE_FAIL=1 \
|
|
FAKE_ARGS_FILE="$TMP_ROOT/crash-args" \
|
|
FUZZ_TARGET=path_containment \
|
|
FUZZ_SEED=42 \
|
|
MAX_TOTAL_TIME=5 \
|
|
ARTIFACT_ROOT="$CRASH_ARTIFACTS" \
|
|
SKIP_BUILD=1 \
|
|
USE_PREBUILT_BINARY=1 \
|
|
PREBUILT_BINARY_DIR="$TMP_ROOT/bin" \
|
|
"$REPO_ROOT/scripts/fuzz/run.sh" >/dev/null 2>&1; then
|
|
echo "crashing fuzz binary should exit non-zero" >&2
|
|
exit 1
|
|
fi
|
|
grep -Fx 'exit_code=77' "$CRASH_ARTIFACTS/path_containment/run-manifest.txt"
|
|
grep -Fx 'reproducer_file=crash-deadbeef' "$CRASH_ARTIFACTS/path_containment/run-manifest.txt"
|
|
grep -E '^reproducer_sha256=[0-9a-f]{64}$' "$CRASH_ARTIFACTS/path_containment/run-manifest.txt"
|
|
|
|
cat > "$TMP_ROOT/bin/cargo" <<'EOF'
|
|
#!/bin/sh
|
|
printf '%s\n' "$@" > "$FAKE_CARGO_ARGS_FILE"
|
|
if [ -n "${FAKE_CARGO_COMMANDS:-}" ]; then
|
|
printf '%s\n' "$*" >> "$FAKE_CARGO_COMMANDS"
|
|
fi
|
|
exit "${FAKE_CARGO_EXIT:-0}"
|
|
EOF
|
|
chmod +x "$TMP_ROOT/bin/cargo"
|
|
|
|
CARGO_ARTIFACTS="$TMP_ROOT/cargo-artifacts"
|
|
PATH="$TMP_ROOT/bin:$PATH" \
|
|
FAKE_CARGO_ARGS_FILE="$TMP_ROOT/cargo-args" \
|
|
FUZZ_TARGET=path_containment \
|
|
FUZZ_SEED=987654321 \
|
|
MAX_TOTAL_TIME=9 \
|
|
ARTIFACT_ROOT="$CARGO_ARTIFACTS" \
|
|
SKIP_BUILD=1 \
|
|
"$REPO_ROOT/scripts/fuzz/run.sh"
|
|
|
|
CARGO_MANIFEST="$CARGO_ARTIFACTS/path_containment/run-manifest.txt"
|
|
grep -Fx '+nightly' "$TMP_ROOT/cargo-args"
|
|
grep -Fx 'fuzz' "$TMP_ROOT/cargo-args"
|
|
grep -Fx 'run' "$TMP_ROOT/cargo-args"
|
|
grep -Fx 'path_containment' "$TMP_ROOT/cargo-args"
|
|
grep -Fx -- '-seed=987654321' "$TMP_ROOT/cargo-args"
|
|
grep -Fx 'seed=987654321' "$CARGO_MANIFEST"
|
|
grep -Fx 'runner_mode=cargo-fuzz' "$CARGO_MANIFEST"
|
|
|
|
BUILD_ARTIFACTS="$TMP_ROOT/build-artifacts"
|
|
PATH="$TMP_ROOT/bin:$PATH" \
|
|
FAKE_CARGO_ARGS_FILE="$TMP_ROOT/build-args" \
|
|
FAKE_CARGO_COMMANDS="$TMP_ROOT/build-commands" \
|
|
CARGO_TARGET_DIR='' \
|
|
FUZZ_TARGET=bucket_validation,fuzz_bitrot_framing,fuzz_s3_sigv4_and_xml,path_containment,fuzz_s3_select_sql \
|
|
ARTIFACT_ROOT="$BUILD_ARTIFACTS" \
|
|
BUILD_ONLY=1 \
|
|
"$REPO_ROOT/scripts/fuzz/run.sh"
|
|
cat > "$TMP_ROOT/expected-build-commands" <<'EOF'
|
|
+nightly fuzz build --no-default-features --features core bucket_validation
|
|
+nightly fuzz build --no-default-features --features core fuzz_bitrot_framing
|
|
+nightly fuzz build --no-default-features --features core fuzz_s3_sigv4_and_xml
|
|
+nightly fuzz build --no-default-features --features core path_containment
|
|
+nightly fuzz build --no-default-features --features s3-select fuzz_s3_select_sql
|
|
EOF
|
|
cmp "$TMP_ROOT/build-commands" "$TMP_ROOT/expected-build-commands"
|
|
grep -Fx -- '--no-default-features' "$TMP_ROOT/cargo-args"
|
|
grep -Fx -- 'core' "$TMP_ROOT/cargo-args"
|
|
|
|
failed_build_status=0
|
|
PATH="$TMP_ROOT/bin:$PATH" \
|
|
FAKE_CARGO_ARGS_FILE="$TMP_ROOT/build-args" \
|
|
FAKE_CARGO_EXIT=77 \
|
|
FUZZ_TARGET=path_containment \
|
|
ARTIFACT_ROOT="$BUILD_ARTIFACTS" \
|
|
BUILD_ONLY=1 \
|
|
"$REPO_ROOT/scripts/fuzz/run.sh" || failed_build_status=$?
|
|
test "$failed_build_status" -eq 77
|
|
|
|
PATH="$TMP_ROOT/bin:$PATH" \
|
|
FAKE_CARGO_ARGS_FILE="$TMP_ROOT/all-build-args" \
|
|
FAKE_CARGO_COMMANDS="$TMP_ROOT/all-build-commands" \
|
|
CARGO_TARGET_DIR='' \
|
|
FUZZ_TARGET='' \
|
|
ARTIFACT_ROOT="$BUILD_ARTIFACTS" \
|
|
BUILD_ONLY=1 \
|
|
"$REPO_ROOT/scripts/fuzz/run.sh"
|
|
cat > "$TMP_ROOT/expected-all-build-commands" <<'EOF'
|
|
+nightly fuzz build --no-default-features --features core
|
|
+nightly fuzz build --no-default-features --features s3-select fuzz_s3_select_sql
|
|
EOF
|
|
cmp "$TMP_ROOT/all-build-commands" "$TMP_ROOT/expected-all-build-commands"
|
|
|
|
PATH="$TMP_ROOT/bin:$PATH" \
|
|
FAKE_CARGO_ARGS_FILE="$TMP_ROOT/core-build-args" \
|
|
FAKE_CARGO_COMMANDS="$TMP_ROOT/core-build-commands" \
|
|
CARGO_TARGET_DIR='' \
|
|
FUZZ_TARGET=archive_extract,bucket_validation,fuzz_bitrot_framing,fuzz_filemeta_decode,fuzz_iam_policy_eval,fuzz_kms_envelope,fuzz_s3_sigv4_and_xml,local_metadata,notify_xml,path_containment,policy_ingress,sigv4_request \
|
|
ARTIFACT_ROOT="$BUILD_ARTIFACTS" \
|
|
BUILD_ONLY=1 \
|
|
"$REPO_ROOT/scripts/fuzz/run.sh"
|
|
printf '%s\n' '+nightly fuzz build --no-default-features --features core' > "$TMP_ROOT/expected-core-build-commands"
|
|
cmp "$TMP_ROOT/core-build-commands" "$TMP_ROOT/expected-core-build-commands"
|
|
|
|
for invalid_seed in 0 0123 not-a-number; do
|
|
if FUZZ_TARGET=path_containment FUZZ_SEED="$invalid_seed" SKIP_BUILD=1 "$REPO_ROOT/scripts/fuzz/run.sh" >/dev/null 2>&1; then
|
|
echo "invalid FUZZ_SEED was accepted: $invalid_seed" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
for invalid_target in nonexistent "path_containment;id"; do
|
|
if FUZZ_TARGET="$invalid_target" SKIP_BUILD=1 "$REPO_ROOT/scripts/fuzz/run.sh" >/dev/null 2>&1; then
|
|
echo "unregistered FUZZ_TARGET was accepted: $invalid_target" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
PATH="$TMP_ROOT/bin:$PATH" \
|
|
FAKE_CARGO_ARGS_FILE="$TMP_ROOT/build-cgu-args" \
|
|
FUZZ_TARGET=path_containment \
|
|
FUZZ_CODEGEN_UNITS=16 \
|
|
BUILD_ONLY=1 \
|
|
"$REPO_ROOT/scripts/fuzz/run.sh"
|
|
|
|
grep -Fx '+nightly' "$TMP_ROOT/build-cgu-args"
|
|
grep -Fx 'fuzz' "$TMP_ROOT/build-cgu-args"
|
|
grep -Fx 'build' "$TMP_ROOT/build-cgu-args"
|
|
grep -Fx -- '--codegen-units' "$TMP_ROOT/build-cgu-args"
|
|
grep -Fx '16' "$TMP_ROOT/build-cgu-args"
|
|
grep -Fx 'path_containment' "$TMP_ROOT/build-cgu-args"
|
|
|
|
for invalid_cgu in 0 016 not-a-number "16;id"; do
|
|
if FUZZ_TARGET=path_containment FUZZ_CODEGEN_UNITS="$invalid_cgu" BUILD_ONLY=1 "$REPO_ROOT/scripts/fuzz/run.sh" >/dev/null 2>&1; then
|
|
echo "invalid FUZZ_CODEGEN_UNITS was accepted: $invalid_cgu" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
echo "fuzz runner seed manifest tests passed"
|