svn commit: r230466 - stable/9/sys/kern

Peter Holm pho at FreeBSD.org
Sun Jan 22 18:27:24 UTC 2012


Author: pho
Date: Sun Jan 22 18:27:24 2012
New Revision: 230466
URL: http://svn.freebsd.org/changeset/base/230466

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/9/sys/kern/kern_thr.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/kern_thr.c
==============================================================================
--- stable/9/sys/kern/kern_thr.c	Sun Jan 22 15:44:20 2012	(r230465)
+++ stable/9/sys/kern/kern_thr.c	Sun Jan 22 18:27:24 2012	(r230466)
@@ -200,6 +200,8 @@ create_thread(struct thread *td, mcontex
 		goto fail;
 	}
 
+	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.
@@ -225,8 +227,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-9 mailing list