Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 23 Jul 2020 16:22:31 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 247945] Kernel option KERN_TLS leads to an immediate panic while booting on ARM64 (RPi4)
Message-ID:  <bug-247945-227-bbvoDMMZS6@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-247945-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-247945-227@https.bugs.freebsd.org/bugzilla/>

index | next in thread | previous in thread | raw e-mail

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247945

John Baldwin <jhb@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kib@FreeBSD.org

--- Comment #5 from John Baldwin <jhb@FreeBSD.org> ---
This may be a bug in the arm64 fpu interface?  Note that the kthread calls
fpu_kern_thread() first thing before it's done any work at all.

Ah, I think I see the bug.  cpu_copy_thread() in vm_machdep.c just blindly
copies pcb_flags which means that if the first kthread runs before another one
is forked, the newly forked thread will bogusly have PCB_FP_KERN set in
pcb_flags.

The amd64 version is careful to do this in cpu_copy_thread:

        clear_pcb_flags(pcb2, PCB_FPUINITDONE | PCB_USERFPUINITDONE |
            PCB_KERNFPU);

cpu_fork() for amd64 does an fpuexit() before copying the pcb which effectively
does the same thing.

On arm64, cpu_fork() calls vfp_save_state which does not clear any pcb_flags
after doing vfp_store/vfp_disable.  It also doesn't check pcb_flags to
determine if it should store/disable which is probably wrong. 
cpu_copy_thread() just needs to clear the relevant flags in the new pcb I
think.

-- 
You are receiving this mail because:
You are the assignee for the bug.

help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-247945-227-bbvoDMMZS6>