svn commit: r228573 - in stable/8/sys: conf kern

Peter Holm pho at FreeBSD.org
Fri Dec 16 12:53:16 UTC 2011


Author: pho
Date: Fri Dec 16 12:53:15 2011
New Revision: 228573
URL: http://svn.freebsd.org/changeset/base/228573

Log:
  MFC: r228360
  
  Move cpu_set_upcall(newtd, td) up before the first call of
  thread_free(newtd).  This to avoid a possible page fault in
  cpu_thread_clean() as seen on amd64 with syscall fuzzing.

Modified:
  stable/8/sys/kern/kern_thr.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/conf/ldscript.mips.octeon1.32   (props changed)
  stable/8/sys/conf/ldscript.mips.octeon1.64   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/kern/kern_thr.c
==============================================================================
--- stable/8/sys/kern/kern_thr.c	Fri Dec 16 12:42:02 2011	(r228572)
+++ stable/8/sys/kern/kern_thr.c	Fri Dec 16 12:53:15 2011	(r228573)
@@ -188,6 +188,8 @@ create_thread(struct thread *td, mcontex
 	if (newtd == NULL)
 		return (ENOMEM);
 
+	cpu_set_upcall(newtd, td);
+
 	/*
 	 * Try the copyout as soon as we allocate the td so we don't
 	 * have to tear things down in a failure case below.
@@ -215,8 +217,6 @@ create_thread(struct thread *td, mcontex
 	newtd->td_proc = td->td_proc;
 	newtd->td_ucred = crhold(td->td_ucred);
 
-	cpu_set_upcall(newtd, td);
-
 	if (ctx != NULL) { /* old way to set user context */
 		error = set_mcontext(newtd, ctx);
 		if (error != 0) {


More information about the svn-src-stable-8 mailing list