svn commit: r339052 - stable/11/sys/compat/freebsd32

Alan Somers asomers at FreeBSD.org
Mon Oct 1 15:49:45 UTC 2018


Author: asomers
Date: Mon Oct  1 15:49:43 2018
New Revision: 339052
URL: https://svnweb.freebsd.org/changeset/base/339052

Log:
  MFC r336871, r336874
  
  r336871:
  getrusage(2): fix return value under 32-bit emulation
  
  According to the man page, getrusage(2) should return EFAULT if the rusage
  argument lies outside of the process's address space. But due to an
  oversight in r100384, that's never been the case during 32-bit emulation.
  Fix it.
  
  PR:		230153
  Reported by:	tests(7)
  Reviewed by:	cem
  Differential Revision:	https://reviews.freebsd.org/D16500
  
  r336874:
  freebsd32_getrusage(2): skip freebsd32_rusage_out on error
  
  PR:		230153
  Reported by:	kib
  X-MFC-With:	336871
  Differential Revision:	https://reviews.freebsd.org/D16500

Modified:
  stable/11/sys/compat/freebsd32/freebsd32_misc.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/freebsd32/freebsd32_misc.c
==============================================================================
--- stable/11/sys/compat/freebsd32/freebsd32_misc.c	Mon Oct  1 15:47:34 2018	(r339051)
+++ stable/11/sys/compat/freebsd32/freebsd32_misc.c	Mon Oct  1 15:49:43 2018	(r339052)
@@ -724,9 +724,7 @@ freebsd32_getrusage(struct thread *td, struct freebsd3
 	int error;
 
 	error = kern_getrusage(td, uap->who, &s);
-	if (error)
-		return (error);
-	if (uap->rusage != NULL) {
+	if (error == 0) {
 		freebsd32_rusage_out(&s, &s32);
 		error = copyout(&s32, uap->rusage, sizeof(s32));
 	}


More information about the svn-src-stable-11 mailing list