β¬’ DragonFlyBSD Kernel Audit
← triage Β· dashboard
DF-0994

sastart ERR_PENDING drain uses stale bio pointer after goto again -> double biodone, queue corruption, bio UAF

Summary

sastart at scsi_sa.c:1603-1625 ERR_PENDING drain loop: bio set once at :1590 (outside if/else). EOF_PENDING sub-branch :1615 does biodone(done_bio) at :1624 then goto again at :1625 WITHOUT refreshing bio. again: at :1603 re-enters -> queue_count-- (underflow), bioq_remove on already-removed bio (TAILQ corruption), bio->bio_buf UAF read, bp->b_resid UAF write, biodone(done_bio) second time (double biodone on freed/reused buf per vfs_bio.c:3746 WARNING). Trigger: tape read in fixed-block mode returns FILEMARK sense with >=2 reads outstanding -> saerror sets SA_FLAG_EOF_PENDING -> next sastart fires. Malicious SCSI/iSCSI tape target (T_SEQUENTIAL) returns CHECK CONDITION with SSD_FILEMARK. Local: root opens /dev/sa0 MTSETBSIZ fixed-block then async reads across filemark. Fix: bio=bioq_first(&softc->bio_queue) before goto again.

Discussion (0)

No comments yet.

PoC verification

Evidence pack

findings/poc/DF-0994 Β· 10 files
FileTypeDescriptionSize
sastart_harness.c trigger-source faithful replication of the ERR_PENDING drain loop 3.8 KB view raw
build.sh build-script cc -O2 -Wall [-DFIXED] 161 B view raw
run.sh run-script runs vulnerable + fixed 142 B view raw
run.log run-log vulnerable: underflow + 16x double biodone 3.7 KB view raw
run_fixed.log run-log fixed: clean drain, queue_count=0 618 B view raw
fix.diff suggested-fix refresh bio before goto again 658 B view raw
env.txt environment no tape device on guest 432 B view raw
fix_build.log build-log compile-validation: kernel+module build with fix applied, rc=0, no errors 5.6 MB ↓ download
../fix_build_combined.log build-log Combined 41-finding kernel build (rc=0, -Werror clean) 5.6 MB ↓ download
../fix_build_summary.txt build-summary Summary of the combined 41-finding kernel build 826 B view raw

Fix verification

fixed

compile+harness validated

see evidence pack

Confirmed kernel references

β€”

Detail

Exploit chain

none

Evidence (decisive lines)

β€”

Verdict

REPRODUCED (harness). sastart ERR_PENDING goto again on stale bio -> double biodone + queue_count underflow + TAILQ corruption. No tape device.