Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Feb 2017 22:54:52 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r314429 - in head/sys: amd64/amd64 i386/i386
Message-ID:  <201702282254.v1SMsq0l086613@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Feb 28 22:54:52 2017
New Revision: 314429
URL: https://svnweb.freebsd.org/changeset/base/314429

Log:
  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

Modified:
  head/sys/amd64/amd64/machdep.c
  head/sys/i386/i386/machdep.c

Modified: head/sys/amd64/amd64/machdep.c
==============================================================================
--- head/sys/amd64/amd64/machdep.c	Tue Feb 28 22:49:45 2017	(r314428)
+++ head/sys/amd64/amd64/machdep.c	Tue Feb 28 22:54:52 2017	(r314429)
@@ -1734,6 +1734,7 @@ hammer_time(u_int64_t modulep, u_int64_t
 	 * 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) +

Modified: head/sys/i386/i386/machdep.c
==============================================================================
--- head/sys/i386/i386/machdep.c	Tue Feb 28 22:49:45 2017	(r314428)
+++ head/sys/i386/i386/machdep.c	Tue Feb 28 22:54:52 2017	(r314429)
@@ -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) +



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702282254.v1SMsq0l086613>