Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 Dec 2011 17:19:41 +0000 (UTC)
From:      Peter Holm <pho@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r228360 - head/sys/kern
Message-ID:  <201112091719.pB9HJflN042113@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) {



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