Fix sendmail improper close-on-exec flag handling. [SA-14:11] Fix ktrace memory disclosure. [SA-14:12] Fix incorrect error handling in PAM policy parser. [SA-14:13] Fix triple-fault when executing from a threaded process. [EN-14:06]
		
			
				
	
	
		
			77 lines
		
	
	
	
		
			2.5 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
			
		
		
	
	
			77 lines
		
	
	
	
		
			2.5 KiB
		
	
	
	
		
			Diff
		
	
	
	
	
	
| Index: sys/sys/proc.h
 | |
| ===================================================================
 | |
| --- sys/sys/proc.h	(revision 266581)
 | |
| +++ sys/sys/proc.h	(revision 266582)
 | |
| @@ -425,6 +425,7 @@ do {									\
 | |
|  #define	TDP_NERRNO	0x08000000 /* Last errno is already in td_errno */
 | |
|  #define	TDP_UIOHELD	0x10000000 /* Current uio has pages held in td_ma */
 | |
|  #define	TDP_DEVMEMIO	0x20000000 /* Accessing memory for /dev/mem */
 | |
| +#define	TDP_EXECVMSPC	0x40000000 /* Execve destroyed old vmspace */
 | |
|  
 | |
|  /*
 | |
|   * Reasons that the current thread can not be run yet.
 | |
| Index: sys/kern/kern_exec.c
 | |
| ===================================================================
 | |
| --- sys/kern/kern_exec.c	(revision 266581)
 | |
| +++ sys/kern/kern_exec.c	(revision 266582)
 | |
| @@ -283,6 +283,7 @@ kern_execve(td, args, mac_p)
 | |
|  	struct mac *mac_p;
 | |
|  {
 | |
|  	struct proc *p = td->td_proc;
 | |
| +	struct vmspace *oldvmspace;
 | |
|  	int error;
 | |
|  
 | |
|  	AUDIT_ARG_ARGV(args->begin_argv, args->argc,
 | |
| @@ -299,6 +300,8 @@ kern_execve(td, args, mac_p)
 | |
|  		PROC_UNLOCK(p);
 | |
|  	}
 | |
|  
 | |
| +	KASSERT((td->td_pflags & TDP_EXECVMSPC) == 0, ("nested execve"));
 | |
| +	oldvmspace = td->td_proc->p_vmspace;
 | |
|  	error = do_execve(td, args, mac_p);
 | |
|  
 | |
|  	if (p->p_flag & P_HADTHREADS) {
 | |
| @@ -313,6 +316,12 @@ kern_execve(td, args, mac_p)
 | |
|  			thread_single_end();
 | |
|  		PROC_UNLOCK(p);
 | |
|  	}
 | |
| +	if ((td->td_pflags & TDP_EXECVMSPC) != 0) {
 | |
| +		KASSERT(td->td_proc->p_vmspace != oldvmspace,
 | |
| +		    ("oldvmspace still used"));
 | |
| +		vmspace_free(oldvmspace);
 | |
| +		td->td_pflags &= ~TDP_EXECVMSPC;
 | |
| +	}
 | |
|  
 | |
|  	return (error);
 | |
|  }
 | |
| Index: sys/vm/vm_map.c
 | |
| ===================================================================
 | |
| --- sys/vm/vm_map.c	(revision 266581)
 | |
| +++ sys/vm/vm_map.c	(revision 266582)
 | |
| @@ -3751,6 +3751,8 @@ vmspace_exec(struct proc *p, vm_offset_t minuser,
 | |
|  	struct vmspace *oldvmspace = p->p_vmspace;
 | |
|  	struct vmspace *newvmspace;
 | |
|  
 | |
| +	KASSERT((curthread->td_pflags & TDP_EXECVMSPC) == 0,
 | |
| +	    ("vmspace_exec recursed"));
 | |
|  	newvmspace = vmspace_alloc(minuser, maxuser, NULL);
 | |
|  	if (newvmspace == NULL)
 | |
|  		return (ENOMEM);
 | |
| @@ -3767,7 +3769,7 @@ vmspace_exec(struct proc *p, vm_offset_t minuser,
 | |
|  	PROC_VMSPACE_UNLOCK(p);
 | |
|  	if (p == curthread->td_proc)
 | |
|  		pmap_activate(curthread);
 | |
| -	vmspace_free(oldvmspace);
 | |
| +	curthread->td_pflags |= TDP_EXECVMSPC;
 | |
|  	return (0);
 | |
|  }
 | |
|  
 | |
| Index: .
 | |
| ===================================================================
 | |
| --- .	(revision 266581)
 | |
| +++ .	(revision 266582)
 | |
| 
 | |
| Property changes on: .
 | |
| ___________________________________________________________________
 | |
| Modified: svn:mergeinfo
 | |
|    Merged /head:r266464
 |