svn commit: r314429 - in head/sys: amd64/amd64 i386/i386

Konstantin Belousov kib at FreeBSD.org
Tue Feb 28 22:54:54 UTC 2017


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) +


More information about the svn-src-all mailing list