Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Jan 2015 23:07:23 +0000 (UTC)
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r276727 - head/sys/kern
Message-ID:  <201501052307.t05N7Nfj001099@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: markj
Date: Mon Jan  5 23:07:22 2015
New Revision: 276727
URL: https://svnweb.freebsd.org/changeset/base/276727

Log:
  Use crcopysafe(9) to make a copy of a process' credential struct. crcopy(9)
  may perform a blocking memory allocation, which is unsafe when holding a
  mutex.
  
  Differential Revision:	https://reviews.freebsd.org/D1443
  Reviewed by:	rwatson
  MFC after:	1 week
  Sponsored by:	EMC / Isilon Storage Division

Modified:
  head/sys/kern/sys_capability.c

Modified: head/sys/kern/sys_capability.c
==============================================================================
--- head/sys/kern/sys_capability.c	Mon Jan  5 21:39:35 2015	(r276726)
+++ head/sys/kern/sys_capability.c	Mon Jan  5 23:07:22 2015	(r276727)
@@ -102,8 +102,7 @@ sys_cap_enter(struct thread *td, struct 
 	newcred = crget();
 	p = td->td_proc;
 	PROC_LOCK(p);
-	oldcred = p->p_ucred;
-	crcopy(newcred, oldcred);
+	oldcred = crcopysafe(p, newcred);
 	newcred->cr_flags |= CRED_FLAG_CAPMODE;
 	p->p_ucred = newcred;
 	PROC_UNLOCK(p);



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