svn commit: r228360 - head/sys/kern

Peter Holm pho at FreeBSD.org
Fri Dec 9 17:19:42 UTC 2011


Author: pho
Date: Fri Dec  9 17:19:41 2011
New Revision: 228360
URL: http://svn.freebsd.org/changeset/base/228360

Log:
  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.
  
  Reviewed by:	kib
  MFC after:	1 week

Modified:
  head/sys/kern/kern_thr.c

Modified: head/sys/kern/kern_thr.c
==============================================================================
--- head/sys/kern/kern_thr.c	Fri Dec  9 13:28:41 2011	(r228359)
+++ head/sys/kern/kern_thr.c	Fri Dec  9 17:19:41 2011	(r228360)
@@ -201,6 +201,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.
@@ -226,8 +228,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-head mailing list