aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2017-02-28 22:54:52 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2017-02-28 22:54:52 +0000
commit2e6e48fb59e76a93852063e6c427d735ef4aa9ba (patch)
treeb3866ff025fd7359d4ddb4c9dfb08a21c6632800 /sys
parent3fc79998ea7d08699311131c3dd3365ff400c886 (diff)
downloadsrc-2e6e48fb59e76a93852063e6c427d735ef4aa9ba.tar.gz
src-2e6e48fb59e76a93852063e6c427d735ef4aa9ba.zip
Initialize pcb_save for thread0.
Otherwise kernel traps on NULL dereference if fpu_kern(9) is used from the thread0 context. Reported by: cem Reviewed by: cem, jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week
Notes
Notes: svn path=/head/; revision=314429
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/machdep.c1
-rw-r--r--sys/i386/i386/machdep.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index 682307f5fe42..207502fafd3d 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -1734,6 +1734,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree)
* area.
*/
thread0.td_pcb = get_pcb_td(&thread0);
+ thread0.td_pcb->pcb_save = get_pcb_user_save_td(&thread0);
bzero(get_pcb_user_save_td(&thread0), cpu_max_ext_state_size);
if (use_xsave) {
xhdr = (struct xstate_hdr *)(get_pcb_user_save_td(&thread0) +
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index 823a278bb2e4..2911d6604c32 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -2420,6 +2420,7 @@ init386(int first)
* area.
*/
thread0.td_pcb = get_pcb_td(&thread0);
+ thread0.td_pcb->pcb_save = get_pcb_user_save_td(&thread0);
bzero(get_pcb_user_save_td(&thread0), cpu_max_ext_state_size);
if (use_xsave) {
xhdr = (struct xstate_hdr *)(get_pcb_user_save_td(&thread0) +