]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
arm64: initialize pcb in the TBI/PAC/etc. fault case
authorKyle Evans <kevans@FreeBSD.org>
Fri, 1 Sep 2023 02:10:38 +0000 (21:10 -0500)
committerKyle Evans <kevans@FreeBSD.org>
Fri, 1 Sep 2023 02:10:38 +0000 (21:10 -0500)
commit03d104888caea595960605a9ff010da7f39133dc
treebc144cf8f3a0550769a6df92fdaa6e77952aa710
parentd8898333344744342a28d8cb74b50588eb523bb7
arm64: initialize pcb in the TBI/PAC/etc. fault case

After 2c10be9e06d, we may jump to the bad_far label without `pcb` being
set, resulting in a follow-up fault as we may dereference it immediately
after the jump if td_intr_nesting_level == 0.  In this branch, it should
be safe to dereference `td` as we're not handling the special case
mentioned below of accessing it during promotion/demotion.

This seems to fix a null ptr deref I hit during my most recent pkgbase
build attempt on the Windows DevKit, though that was admittedly
encountered while we were on the way to a panic from an apparent
use-after-free in ZFS bits.

Reviewed by: andrew, markj
Fixes: 2c10be9e06d ("arm64: Handle translation faults for thread [..]")
Differential Revision: https://reviews.freebsd.org/D41677
sys/arm64/arm64/trap.c