⬢ DragonFlyBSD Kernel Audit
DF-2237 / p2_trigger_double.sh
← back to finding ↓ download raw
#!/bin/sh
# DF-2237 phase 2: double-byte _wctype trigger (mode 2). Revert to built
# snapshot, arm tables, fire conv_case(FROM_LOWER) on "\xab\xcd" ->
# expect Fatal trap 12 at iconv_xlat16_conv, fault VA = 0xC (NULL + 3*4).
set -e
cd "$(dirname "$0")"
VM=../../../dfbsd-qemu/vm.sh

echo "== P2: revert to built snapshot =="
$VM reset df2237-built

echo "== arm + fire double-byte trigger =="
timeout 90 $VM run_root 'kldload /boot/kernel/libiconv.ko && /root/df2237/armtbl && \
  sysctl debug.debugger_on_panic=0 debug.trace_on_panic=0; \
  kldload /usr/obj/root/df2237/km2/df2237_2.ko; echo "kldload returned $?"' \
  2>&1 | tee run_t2.log || true

sleep 12
echo "== capture serial log =="
cp ../../../dfbsd-qemu/boot.log t2_boot.log
grep -n "Fatal trap" t2_boot.log || true